private function writeHistory($response, $transactionRequest)
 {
     $id_pedido = (int) $this->module->currentOrder;
     $id_transacao = $response->transactionId;
     $id_status = (int) Configuration::get('PS_OS_BCASH_IN_PROGRESS');
     $status = urldecode($response->descriptionStatus);
     $paymentMethodHelper = new PaymentMethodHelper();
     $pagamento_meio = $paymentMethodHelper->getById(Tools::getValue('payment-method'));
     if (PaymentMethodHelper::isCard($pagamento_meio)) {
         $parcelas = Tools::getValue('card-installment');
     } else {
         $parcelas = 1;
     }
     $history = new History($id_pedido, $id_transacao, $id_status, $status, $pagamento_meio->title, $parcelas);
     $history->write();
 }
Ejemplo n.º 2
0
 private function executeCommand()
 {
     if ($pos = strpos(Request::factory()->getCmd(), ' ')) {
         $method = substr(Request::factory()->getCmd(), 0, $pos);
         $args = substr(Request::factory()->getCmd(), $pos + 1);
     } else {
         $method = Request::factory()->getCmd();
         $args = array();
     }
     $command = new Controller_Command();
     if (method_exists($command, $method)) {
         History::write($_SESSION['login'], Request::factory()->getCmd());
         return call_user_func(array($command, $method), $args);
     } else {
         return View::factory('tables/404');
     }
 }
 private function writeHistory($orderId, $transactionId)
 {
     $email = Configuration::get(self::prefix . 'EMAIL');
     $token = Configuration::get(self::prefix . 'TOKEN');
     $consultation = new Consultation($email, $token);
     $consultation->enableSandBox(Configuration::get(self::prefix . 'SANDBOX'));
     try {
         $response = $consultation->searchByTransaction($transactionId);
         $id_pedido = $response->transacao->id_pedido;
         $id_transacao = $transactionId;
         $id_status = $this->getStatus($response->transacao->cod_status);
         $status = $response->transacao->status;
         $pagamento_meio = $response->transacao->meio_pagamento;
         $parcelas = $response->transacao->parcelas;
         $valor_original = $response->transacao->valor_original;
         $valor_loja = $response->transacao->valor_loja;
         $taxa = $valor_original - $valor_loja;
         $history = new History($id_pedido, $id_transacao, $id_status, $status, $pagamento_meio, $parcelas, $valor_original, $valor_loja, $taxa);
         $history->write();
     } catch (ValidationException $e) {
         $this->logHistoryFail($orderId, $transactionId, $statusId, $e);
     } catch (ConnectionException $e) {
         $this->logHistoryFail($orderId, $transactionId, $statusId, $e);
     }
 }
 static function writeNewOrderStatus($orderId, $novoStatus)
 {
     $oldHistory = self::getLastByOrder($orderId);
     $history = new History($oldHistory['id_pedido'], $oldHistory['id_transacao'], $novoStatus['id'], $novoStatus['status'], $oldHistory['pagamento_meio'], $oldHistory['parcelas'], $oldHistory['valor_original'], $oldHistory['valor_loja'], $oldHistory['taxa']);
     $history->write();
 }