/** * @param AddToBasketRequest $request * * @throws \ChingShop\Modules\Sales\Domain\Payment\StockAllocationException * * @return \Illuminate\Http\RedirectResponse */ public function addProductOptionAction(AddToBasketRequest $request) { $productOption = $this->optionRepository->loadById($request->optionId()); try { $this->clerk->addProductOptionToBasket($productOption); } catch (StockAllocationException $e) { $this->webUi->warningMessage($e->getMessage()); return $this->webUi->redirectAway($productOption->product->url()); } $this->webUi->successMessage(sprintf('1 × <strong>%s (%s)</strong> was added to your basket.', $productOption->product->name, $productOption->label)); Analytics::trackEvent('basket', 'add', $productOption->product->sku, $productOption->label); return $this->webUi->redirect('sales.customer.basket'); }
/** * Remove the specified resource from storage. * * @param int $id * * @throws \Exception * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * * @return \Illuminate\Http\Response */ public function destroy(int $id) { /** @var Offer $offer */ $offer = $this->offer->findOrFail($id); $offer->delete(); $this->webUi->warningMessage("Deleted offer `{$offer->name}`."); return $this->webUi->redirect('offers.index'); }
/** * @return RedirectResponse */ public function cancelAction() { $this->webUi->warningMessage('No worries, your PayPal payment was cancelled. Please choose a payment method'); return $this->webUi->redirect('sales.customer.checkout.choose-payment'); }