Пример #1
0
 /**
  * PUT order data to Ginger API.
  *
  * @param Order $order
  * @return Order
  */
 private function putOrder(Order $order)
 {
     try {
         return Order::fromArray($this->httpClient->put("orders/" . $order->id() . "/", ["timeout" => 3, "json" => $order->toArray()])->json());
     } catch (RequestException $exception) {
         if ($exception->getCode() == 404) {
             throw new OrderNotFoundException('No order with that ID was found.', 404, $exception);
         }
         throw new ClientException('An error occurred while updating the order: ' . $exception->getMessage(), $exception->getCode(), $exception);
     }
 }