public function completeOrder($transactionReference = null) { if ($transactionReference) { $this->setTransactionReference($transactionReference); $this->save(); } //in case of external payment hitting, update the status. //otherwise nothing should really happen. $this->updateStatus(); $this->dispatchEmailNotifications(); StoreCustomer::addCustomerToUserGroupsByOrder($this); $event = new StoreOrderEvent($this); Events::dispatch('on_vividstore_order', $event); // unset the shipping type, as next order might be unshippable \Session::set('smID', ''); StoreCart::clear(); return $this; }