/**
  * @param OrderRepository $orderRepository
  * @param CustomerRepository $customerRepository
  * @param $orderId
  * @return \Illuminate\Contracts\View\View
  */
 public function view(OrderRepository $orderRepository, CustomerRepository $customerRepository, $orderId)
 {
     $data['customer'] = $customerRepository->find();
     $data['order'] = $orderRepository->find($orderId);
     $data['defaultAddress'] = $data['order']->getBillingAddress();
     $data['pageTitle'] = trans('vendirun::product.viewOrder');
     return View::make('vendirun::customer.orders.view', $data);
 }
 /**
  * @param OrderRepository $orderRepository
  * @param CartRepository $cartRepository
  * @param int $orderId
  * @return \Illuminate\Contracts\View\View
  */
 public function failure(OrderRepository $orderRepository, CartRepository $cartRepository, $orderId)
 {
     // clear the cart because the order already exists
     $cartRepository->save($cartRepository->find()->clear());
     // if NULL, we'll get the most recent order from session
     try {
         $data['order'] = $orderRepository->find($orderId, Session::get('orderOneTimeToken', NULL));
         Session::remove('orderOneTimeToken');
     } catch (FailResponseException $e) {
         // if we can't find a valid order, might just be that the session has expired,
         //    in which case we just won't show the order details
         $data['order'] = NULL;
     }
     $data['pageTitle'] = trans('vendirun::checkout.orderFailedTitle');
     return View::make('vendirun::checkout.failure', $data);
 }