Skip to content

Commit

Permalink
Improved create order shipment, mark shipment as shipped
Browse files Browse the repository at this point in the history
  • Loading branch information
kg-bot committed Aug 19, 2019
1 parent 91cbbdd commit da2e1d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ public function createShipment()
{
return $this->request->handleWithExceptions(function () {

return $this->request->client->post("{$this->entity}/{$this->{$this->primaryKey}}/create-shipment")
$response = $this->request->client->post("{$this->entity}/{$this->{$this->primaryKey}}/create-shipment")
->getBody()
->getContents();

return new OrderShipment($this->request, $response->order_shipment);
});
}
}
10 changes: 10 additions & 0 deletions src/Models/OrderShipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ class OrderShipment extends Model
{
protected $entity = 'order-shipments';
protected $primaryKey = 'id';

public function markShipped()
{
return $this->request->handleWithExceptions(function () {

return $this->request->client->post("orders/shipments/{$this->{$this->primaryKey}}/mark-shipped")
->getBody()
->getContents();
});
}
}

0 comments on commit da2e1d2

Please sign in to comment.