public function process(Order $order) { $product = $order->getProduct(); $mobileMoney = $this->getMobileMoneyInfo()->findByCourier($this->getCourier()); $responseMessage = 'Proceed to deposit ' . $product->getPrice() . ' into ' . $mobileMoney->title . ' number ' . $mobileMoney->number . ' using your ' . Config::get('app.name') . ' username as the reference to complete your order. Thank you.'; // untrack order $this->getOrders()->untrack(); $this->setFailed(false); $this->setResponseMessage($responseMessage); return redirect('/')->with('success', $responseMessage); }
/** * @param Order $order * @return \Illuminate\Http\RedirectResponse */ public function process(Order $order) { $product = $order->getProduct(); $this->setPaymentAmount($product->getPrice()); // bind item/order info $unitPrice = $this->getPaymentAmount(); $totalPrice = $this->getPaymentAmount(); $title = $product->getTypeName() . ': ' . $product->getTitle(); $this->getInvoice()->addItem($title, 1, $unitPrice, $totalPrice); $this->getInvoice()->setTotalAmount($totalPrice); $this->getInvoice()->addCustomData(Order::ORDER_FEEDBACK_NAME, $order->reference); if ($this->getInvoice()->create()) { // untrack order $this->getOrders()->untrack(); $this->setFailed(false); $this->setResponseMessage('You have successfully puchased ' . $order->quantity . ' ' . $product->getTitle()); return redirect()->away($this->getInvoice()->getInvoiceUrl()); } else { $this->setResponseMessage('Sorry! Your purchased was unsuccessful.' . ' ' . 'No worries, you can pay from your orders.'); } }
public function getByReference($reference) { return Order::where('reference', $reference)->first(); }