public function handleUpdate($messageId) { // AddCreditRequest::$instance->log->write('Starting'); $request = Messaging::getSystemMessage($messageId); // AddCreditRequest::$instance->log->write(print_r($request, true)); if ($request['data']->status == ADD_CREDIT_STATUS_ACCEPTED) { $this->load->library("Transaction"); Transaction::addCredit($request['senderId'], $request['data']->amount, $request['data']->currency, $this->registry, $request['data']->comment); } }
public function saveComment() { // $this->log->write(print_r($this->parameters, true)); $request = Messaging::getSystemMessage($this->parameters['requestId']); $request['data']->comment = $this->parameters['comment']; Messaging::updateSystemMessage($request['messageId'], $request['data']); }
public static function updateSystemMessage($messageId, $data) { // Messaging::$instance->log->write(print_r($data, true)); $message = Messaging::getSystemMessage($messageId); Messaging::$instance->db->query("\r\n UPDATE messages\r\n SET\r\n message = '" . Messaging::$instance->db->escape(json_encode($data)) . "'\r\n WHERE message_id = " . (int) $messageId); Messaging::$instance->load->library('SystemMessageClassFactory'); SystemMessageClassFactory::createInstance($message['messageTypeId'], Messaging::$instance->load)->handleUpdate($messageId); }