private function postOrder(Order $order)
    {
        try {
            $response = $this->getHttpClient()
                ->method(Http::POST)
                ->uri($this->baseUrl . 'orders/')
                ->timeout(30)
                ->sends(Mime::JSON)
                ->body(ArrayFunctions::withoutNullValues($order->toArray()))
                ->send();

            if ($response->hasErrors()) {
                throw new \Exception($response->raw_body, $response->code);
            }

            return Order::fromArray($response->body);
        } catch (\Exception $exception) {
            throw new ClientException(
                'An error occurred while posting the order: '.$exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
private function postOrder(Order $order)
    {
        try {
            $response = $this->getHttpClient()
                ->method(Http::POST)
                ->uri($this->baseUrl . 'orders/')
                ->timeout(30)
                ->sends(Mime::JSON)
                ->body(ArrayFunctions::withoutNullValues($order->toArray()))
                ->send();

            if ($response->hasErrors()) {
                throw new \Exception($response->raw_body, $response->code);
            }

            return Order::fromArray($response->body);
        } catch (\Exception $exception) {
            throw new ClientException(
                'An error occurred while posting the order: '.$exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
private function postOrder ( Order $ order ) { try { $ response = $ this -> getHttpClient ( ) -> method ( Http :: POST ) -> uri ( $ this -> baseUrl . 'orders/' ) -> timeout ( 30 ) -> sends ( Mime :: JSON ) -> body ( ArrayFunctions :: withoutNullValues ( $ order -> toArray ( ) ) ) -> send ( ) ; if ( $ response -> hasErrors ( ) ) { throw new \ Exception ( $ response -> raw_body , $ response -> code ) ; } return Order :: fromArray ( $ response -> body ) ; } catch ( \ Exception $ exception ) { throw new ClientException ( 'An error occurred while posting the order: ' . $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } }
Post a new order.

@param Order $order
@return Order
Post a new order .