コード例 #1
0
 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);
 }
コード例 #2
0
 /**
  * @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.');
     }
 }
コード例 #3
0
 public function getByReference($reference)
 {
     return Order::where('reference', $reference)->first();
 }