private function updateOrder()
 {
     $this->order->total = Cart::total();
     $this->order->save();
     $this->deleteOrderItems();
     $this->saveOrderItems();
     $this->session->set(Auth::user()->id, $this->order);
 }
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $order = Order::findByInvoiceNumber($this->invoiceNo);
     if ($order) {
         $order->update(['status' => 'unpaid']);
         return true;
     }
     return false;
 }
Exemple #3
0
 /**
  * Generates a unique invoice number
  *
  * @return string
  */
 private function generateInvoiceNumber()
 {
     $invoice_no = 'INV' . mt_rand(100000, 999999);
     $order = Order::where(['invoice_no' => $invoice_no])->get(['invoice_no']);
     if (count($order)) {
         $this->generateInvoiceNumber();
     }
     return $invoice_no;
 }
 /**
  * @param Request $request
  * @param Writer  $logger
  * @param         $payFastData
  */
 protected function updateOrderStatus(Request $request, Writer $logger, $payFastData)
 {
     $order = Order::where('invoice_no', $request->input('m_payment_id'))->first();
     switch ($payFastData['payment_status']) {
         case self::STATUS_COMPLETE:
             $logger->debug(self::PAYMENT_STATUS_COMPLETE);
             $order->status = strtolower(self::STATUS_COMPLETE);
             break;
         case self::STATUS_FAILED:
             $logger->error(self::PAYMENT_STATUS_FAILED);
             $order->status = strtolower(self::STATUS_FAILED);
             break;
         case self::STATUS_PENDING:
             $logger->debug(self::PAYMENT_STATUS_PENDING);
             $order->status = strtolower(self::STATUS_PENDING);
             break;
         default:
             $logger->error(self::PAYMENT_STATUS_DEFAULT);
             $order->status = self::ERROR;
             break;
     }
     $order->save();
 }