✏️ 正在编辑: SimulacaoAbertaController.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/controllers/SimulacaoAbertaController.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php use Modules\SimulacaoAberta\Service\SimulacaoAbertaService; class SimulacaoAbertaController extends Zend_Controller_Action { /** @var string */ public const CONTROLLER = 'simulacao-aberta', SUCESSO_TITULO = 'Simulação enviada.', SUCESSO_MENSAGEM = 'Sua simulação foi enviada para análise. Verifique seu e-mail/whatsapp para mais informações', ANDAMENTO_TITULO = 'Simulação em andamento.', ANDAMENTO_MENSAGEM = 'Já existe uma simulação em andamento no nosso sistema, em breve entraremos em contato.', ERRO_TITULO = 'Solicitação não enviada.', ERRO_MENSAGEM = 'Ocorreu um erro durante a solicitação.', MSG_ERRO = 'DESCULPE, DADOS NÃO LOCALIZADOS.', TITULO_NOTIFICACAO = 'Simulação de crédito', MSG_NOTIFICACAO = 'Nova simulação enviada por link externo', MSG_NOTIFICACAO_CONTATO_SOLICITADO = 'Contato solicitado através da visualização da simulação', PAGE_TITLE_FGTS = "Saque-aniversário FGTS", PAGE_TITLE_INSS = "Simulação Empréstimo INSS", PAGE_TITLE = "Soluções em Crédito para Você" ; public const APPLE_STORE = [ "description" => "Baixar aplicativo FGTS para IOS", "url" => "https://apps.apple.com/br/app/fgts/id1038441027", "icon" => "assets/simulador/app-ios.png" ], GOOGLE_STORE = [ "description" => "Baixar aplicativo FGTS para Android", "url" => "https://play.google.com/store/apps/details?id=br.gov.caixa.fgts.trabalhador", "icon" => "assets/simulador/app-android.png" ]; public $corretorId = null; public $tipo = null; public $ldp = null; private $_urlReferencia = ""; public function init() { $this->tipo = strtolower($this->getRequest()->getParam('tipo')); if (!$this->tipo) { try { $params = \Core_Link::trataQuery(); $this->corretorId = $params['corretor_id'] ?? 0; $this->ldp = $params['ldp'] ?? false; $this->tipo = $params['tipo_operacao'] ? strtolower($params['tipo_operacao']) : null; } catch (Core_Exception $e) { // } } $this->view->site_title = self::PAGE_TITLE; if ($this->tipo == 'inss') { $this->view->site_title = self::PAGE_TITLE_INSS; } elseif ($this->tipo == 'fgts') { $this->view->site_title = self::PAGE_TITLE_FGTS; } if ($this->tipo == 'fgts' || $this->tipo == 'inss') { $this->_helper->layout->setLayout('layout_simulacao'); $config = include CLIENT_PATH . '/configs/callcenter.php'; if ($this->ldp && !empty($config['html_autocontratacao']) && $this->tipo == 'fgts') { unset($params['ldp'], $params['uri']); $query = http_build_query($params); $urlRedirect = \Core_Link::criaLink($_SERVER['REDIRECT_URL'], $query); $this->view->html = str_replace("[LINK_AUTO]", $urlRedirect, $config['html_autocontratacao']); $this->_helper->layout->setLayout('layout_proprio'); } $this->view->orgao_emissor = [""] + Core_Combos::getOrgaoEmissorOptions(); $dadosRodape['razao_social'] = $config['nome_empresa']; $dadosRodape['cnpj'] = $config['cnpj_empresa']; $dadosRodape['endereco'] = $config['endereco_empresa']; $dadosRodape['cep'] = $config['cep_empresa']; $dadosRodape['fone'] = $config['fone_empresa']; $this->view->dadosEmpresa = $dadosRodape; try { $bancosParceiros = \Core_Banco_Service_Autocontratacao_Fgts::getBancosHabilitados(); $this->view->bancosParceiros = array_flip(array_map(function ($item) { return $item['banco']; }, $bancosParceiros)); } catch (Core_Exception $e) { die($e->getMessage()); } } else { $this->_helper->layout->setLayout('layout_simulacao_chat'); $this->view->convenios = Core_Combos::getConveniosSimulacaoAbertaOptions(); } $this->view->bancosFban = Core_Combos::getBancosAutocontratacaoOptions(); $this->view->tipo_beneficios = [""] + Core_Combos::getEspeciesConsignaveisOptions(); if (isset($_SERVER['HTTP_ORIGIN'])) { header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); header('Access-Control-Allow-Credentials: true'); header('Access-Control-Max-Age: 86400'); // cache for 1 day } // Access-Control headers are received during OPTIONS requests if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) { header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); } if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); } exit(0); } $this->_urlReferencia = $_SERVER['HTTP_REFERER']; } public function indexAction() { if (stripos($_SERVER['HTTP_USER_AGENT'],"iPhone") || stripos($_SERVER['HTTP_USER_AGENT'],"iPad")) { $this->view->app_store = self::APPLE_STORE; } elseif (stripos($_SERVER['HTTP_USER_AGENT'],"Android")) { $this->view->app_store = self::GOOGLE_STORE; } $this->view->tipo = $this->tipo; $this->view->corretor_id = $this->corretorId; } public function saveAction() { try { $service = new SimulacaoAbertaService(); $service->salvarCliente($this->getRequest()->getPost()); $service->checaSimulacaoExistente(); if ($service->getSimulacaoExistenteId()) { $this->_helper->redirector('sucesso', self::CONTROLLER, null, ['nova' => false]); } $service->salvarSimulacao(); $this->_helper->redirector('sucesso', self::CONTROLLER, null, ['nova' => true]); } catch (Throwable $throwable) { $this->_helper->redirector('erro', self::CONTROLLER, null, ['msg' => $throwable->getMessage()]); } } public function sucessoAction() { $nova = $this->getRequest()->getParam('nova'); $this->view->titulo = $nova ? self::SUCESSO_TITULO : self::ANDAMENTO_TITULO; $this->view->corpo = $nova ? self::SUCESSO_MENSAGEM : self::ANDAMENTO_MENSAGEM; Core_Notificacao_PushBrowser::notify( 'simulacao', self::TITULO_NOTIFICACAO, self::MSG_NOTIFICACAO, [ "cod_assunto" => 1, "url" => "callcenter/simulacoes-abertas" ] ); $this->_helper->json(['success' => true, 'content' => $this->view->render('simulacao-aberta/sucesso.phtml')]); } public function erroAction() { $this->view->titulo = self::ERRO_TITULO; $this->view->corpo = self::ERRO_MENSAGEM . ' ' . $this->getRequest()->getParam('msg'); $this->_helper->json(['error' => true, 'content' => $this->view->render('simulacao-aberta/erro.phtml')]); } public function exibirAction() { try { $params = \Core_Link::trataQuery(); $service = new SimulacaoAbertaService(); if (empty(Yuppie_Auth::getIdentity())) { $service->registrarAcesso($params['chave']); } $this->view->bancos = $service->getSimulacaoExibir($params['chave']); } catch (Throwable $throwable) { $this->view->erro = self::MSG_ERRO; } } public function registrarSolicitacaoAction() { $params = $this->getRequest()->getParams(); try { $service = new SimulacaoAbertaService(); $service->registrarSolicitacao($params); Core_Notificacao_PushBrowser::notify('simulacao', self::TITULO_NOTIFICACAO, self::MSG_NOTIFICACAO_CONTATO_SOLICITADO, [ "cod_assunto" => 1, "url" => "callcenter/simulacoes-abertas" ] ); $this->_helper->json(['success' => true]); } catch (Exception $exception) { $this->_helper->json(['error' => true]); } } public function leadCaptureAction() { $dados = $this->getRequest()->getPost(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $params); $dados['tipo'] = $dados['tipo'] ?? "NOVO"; $dados['convenio'] = $dados['convenio'] ?? 0; $dados['tipo_valor'] = $dados['tipo_valor'] ?? "CREDITO"; $dados['utm_source'] = $params['utm_source'] ?? "plugin"; $dados['utm_campaign'] = $params['utm_campaign'] ?? $_SERVER['HTTP_REFERER']; $dados['valor_solicitado'] = $dados['valor_solicitado'] ?? $dados['saldo-fgts'] ?? 0; $dados['fone'] = $dados['fone'] ?? $dados['phone'] ?? 0; $dados['http_referer'] = $this->_urlReferencia; Yuppie_Log::write("Captura de lead iniciada => " . print_r($dados, true), $this); try { $service = new SimulacaoAbertaService(); $service->salvarCliente($dados); $service->checaSimulacaoExistente(); if ($service->getSimulacaoExistenteId()) { $this->_helper->json(['error' => self::ANDAMENTO_MENSAGEM]); } $service->salvarSimulacao(); $this->_helper->json(['success' => self::SUCESSO_MENSAGEM]); Yuppie_Log::write("Captura de lead => " . self::SUCESSO_MENSAGEM, $this); } catch (Zend_Db_Statement_Exception $e) { Yuppie_Log::write("Captura de lead => " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $this->_helper->json(['error' => "Dados enviados estão incompletos!"]); } catch (Core_Exception $e) { Yuppie_Log::write("Captura de lead => " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $this->_helper->json(['error' => $e->getMessage()]); } catch (Throwable $throwable) { Yuppie_Log::write("Captura de lead => " . $throwable->getMessage() . "\n" . $throwable->getTraceAsString(), $this); $this->_helper->json(['error' => "Erro interno no sistema"]); } } public function autocontratacaoCaptureAction() { $nsFgts = new Zend_Session_Namespace('condicoes_credito'); $nsFgts->unsetAll(); $dados = $this->getRequest()->getPost(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $params); $dados['tipo'] = $dados['tipo'] ?? "NOVO"; $dados['convenio'] = $dados['convenio'] ?? 0; $dados['tipo_valor'] = "CREDITO"; $dados['utm_term'] = $params['utm_term'] ?? ""; $dados['utm_content'] = $params['utm_content'] ?? ""; $dados['utm_medium'] = $params['utm_medium'] ?? ""; $dados['utm_source'] = $params['utm_source'] ?? "auto"; $dados['utm_campaign'] = $params['utm_campaign'] ?? $_SERVER['HTTP_REFERER']; $dados['fone'] = $dados['fone'] ?? $dados['phone'] ?? ''; $dados['renda'] = $dados['renda_valor'] ?? 0; $dados['http_referer'] = $this->_urlReferencia; $service = new SimulacaoAbertaService(); Yuppie_Log::write("Dados enviados para consulta FGTS: " . print_r($dados, true), $this); try { $service->salvarCliente($dados); $service->checaSimulacaoExistente(false); if (!$service->getSimulacaoExistenteId()) { $service->salvarSimulacao(false); } $service->marcarAtendimentoEmAndamento($service->getSimulacaoExistenteId()); $serviceFgts = new \Core_Banco_Service_Autocontratacao_Fgts(); $retorno = $serviceFgts->consultar($dados['cpf'], $service->getDados()['cliente_id']); $origemConsulta = $retorno->origem_consulta; $retorno = current($retorno->condicoes_credito); if ($retorno) { $nsFgts = new Zend_Session_Namespace('condicoes_credito'); $nsFgts->condicoes_credito = $retorno; $nsFgts->condicoes_credito->api = $serviceFgts->getBancoFromClass($origemConsulta); $nsFgts->condicoes_credito->simulacao_id = $service->getSimulacaoExistenteId(); $nsFgts->condicoes_credito->base_id = $service->getDados()['cliente_id']; $nsFgts->condicoes_credito->banco_id = Model_Banco::bancoPorNome($origemConsulta); $service->atualizarValorSaldo($retorno->valor_liquido, $nsFgts->condicoes_credito->banco_id); $service->notificarLeadProcessando($dados['nome'], null, $dados['fone']); $this->_helper->json([ 'success' => true, 'valor_liberado' => number_format($retorno->valor_liquido, 2,',','.'), 'valor_financiado' => number_format($retorno->valor_financiado, 2,',','.'), 'taxa_juros' => number_format($retorno->taxa_referencia_mensal, 2,',','.'), 'parcelas' => $retorno->parcelas, 'origem_consulta' => $origemConsulta ]); } $service->liberarStatusAtendimento($service->getSimulacaoExistenteId()); $service->notificarLeadContratacaoIncompleta($dados['nome'], null, $dados['fone']); $this->_helper->json(['success' => true]); } catch (Zend_Db_Statement_Exception $e) { $service->notificarLeadContratacaoIncompleta($dados['nome'], null, $dados['fone']); $service->notificarErroParaYuppie("Erro de banco na autocontratação", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); Yuppie_Log::write("Dados enviados estão incompletos! " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $this->_helper->json(['error' => "Dados enviados estão incompletos!"]); } catch (Core_Exception $e) { if ($serviceFgts->getNotifica()) { $service->notificarLeadContratacaoIncompleta($dados['nome'], $e->getMessage(), $dados['fone']); } Yuppie_Log::write($e->getMessage(), $this); $this->_helper->json(['error' => $e->getMessage(), 'back' => $e->getCode()]); } catch (Throwable $throwable) { $service->notificarLeadContratacaoIncompleta($dados['nome'], null, $dados['fone']); $service->notificarErroParaYuppie("Erro na autocontratação", $throwable->getMessage() . "<br><br>" . $throwable->getTraceAsString()); Yuppie_Log::write("Erro interno no sistema " . $throwable->getMessage() . "\n" . $throwable->getTraceAsString(), $this); $this->_helper->json(['error' => "Erro interno no sistema. "]); } } public function inclusaoFgtsAction() { $request = $this->getRequest(); $post = $request->getParams(); $nsFgts = new Zend_Session_Namespace('condicoes_credito'); $serviceFgts = $nsFgts->condicoes_credito->api; $bancoId = $nsFgts->condicoes_credito->banco_id; $service = new SimulacaoAbertaService(); if (empty($serviceFgts)) { $this->_helper->json([ 'error' => 'Existe uma instabilidade com a Caixa Econômica Federal ' . 'e sua simulação não foi processada corretamente. Recarregue a tela e tente novamente ou volte mais tarde!' ]); return; } try { $condicoesCredito = $nsFgts->condicoes_credito; $proposta = new Model_Proposta(['banco_id' => $bancoId]); $propostaId = $proposta->saveByInclusaoAutocontratacao($post, $condicoesCredito, 'FGTS'); $efetivado = null; if ($propostaId) { $retornoInclusao = $serviceFgts->inclusaoFgts($post, (array)$condicoesCredito, $propostaId); $serviceFgts->tratarMensagemErro($condicoesCredito->base_id, $retornoInclusao); Yuppie_Log::write(print_r($retornoInclusao, true), $this); $service->marcarAtendimentoDigitado($nsFgts->condicoes_credito->simulacao_id); $efetivado = (new Model_Proposta())->efetivarPropostaInclusao($propostaId, current($retornoInclusao)); $serviceFgts->enviarLinkFormalizacao(current($retornoInclusao)->numero_proposta ?? null, $post['cpf'], $post['fone']); } if (empty($efetivado)) { Yuppie_Log::write("Houve um erro ao efetivar a proposta. " . print_r(['post' => $post, 'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true), $this); $service->notificarErroParaYuppie("Erro na autocontratação ao efetivar a proposta", print_r(['post' => $post,'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true)); $service->adicionarPendencia($propostaId, "Erro na autocontratação ao efetivar a proposta"); $this->_helper->json(['error' => 'Houve um erro ao efetivar a proposta.']); return; } $resultMsg = [ 'success' => 'Dados enviados com sucesso!<br/><br/>', 'description' => 'Você receberá um SMS para envio dos seus documentos. <br/><br/>' . 'Para concluir, acesse o link enviado pelo banco para o número de celular que você informou.' ]; Yuppie_Log::write(print_r($resultMsg, true), $this); $service->limparAgendamentoNotificacao($post['fone']); $service->notificarErroParaYuppie("Autocontratação efetuada com sucesso!", "Dados da autocontratação: <br><br>" . print_r(['post' => $post, 'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true)); $this->_helper->json($resultMsg); } catch (Core_Exception $e) { Yuppie_Log::write("Houve um erro ao enviar a proposta. " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $service->notificarErroParaYuppie("Erro na autocontratação ao enviar a proposta", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); $service->adicionarPendencia($propostaId, $e->getMessage()); $this->_helper->json([ 'error' => 'Houve um erro ao enviar a proposta.', 'description' => $e->getMessage() ]); } catch (Throwable $e) { Yuppie_Log::write("Falha na inclusão de propostas: " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $service->notificarErroParaYuppie("Erro na autocontratação na inclusão da proposta", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); $service->adicionarPendencia($propostaId, $e->getMessage()); $this->_helper->json([ 'error' => 'Erro!', 'description' => 'Falha na inclusão da proposta! Tente novamente mais tarde.' ]); } } public function consultaPorSaldoAction() { $dados = $this->getRequest()->getPost(); $service = new SimulacaoAbertaService(); if (empty($dados['saldo-fgts'])) { $this->_helper->json(['error' => true]); } Yuppie_Log::write("Realizando consulta com o saldo informado: " . $dados['valor_solicitado'], $this); try { $dadosSimulacao = $service->simularFgtsPorSaldo(String_Refatorar::parseStringToFloat($dados['saldo-fgts']), 1.99); $this->_helper->json($dadosSimulacao + ['success' => true]); } catch (Exception $e) { $this->_helper->json(['error' => true]); } } public function autocontratacaoConsignadoAction() { $nsInss = new Zend_Session_Namespace('condicoes_credito'); $nsInss->unsetAll(); $dados = $this->getRequest()->getPost(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $params); $dados['tipo'] = $dados['tipo'] ?? "NOVO"; $dados['tipo_valor'] = "PARCELA"; $dados['utm_term'] = $params['utm_term'] ?? ""; $dados['utm_content'] = $params['utm_content'] ?? ""; $dados['utm_medium'] = $params['utm_medium'] ?? ""; $dados['utm_source'] = $params['utm_source'] ?? "auto"; $dados['utm_campaign'] = $params['utm_campaign'] ?? $_SERVER['HTTP_REFERER']; $dados['http_referer'] = $this->_urlReferencia; $convenioModel = new Model_Convenio(); $dados['convenio'] = $convenioModel->getOrCreateConvenio('INSS'); $service = new SimulacaoAbertaService(); Yuppie_Log::write("Dados enviados para consulta INSS: " . print_r($dados, true), $this); try { $service->salvarCliente($dados); $service->checaSimulacaoExistente(false); if (!$service->getSimulacaoExistenteId()) { $service->salvarSimulacao(false); } $service->marcarAtendimentoEmAndamento($service->getSimulacaoExistenteId()); $serviceInss = new \Core_Banco_Service_Autocontratacao_Inss(); $retorno = $serviceInss->consultar($dados, $service->getDados()['cliente_id']); $origemConsulta = $retorno->origem_consulta; $retorno = current($retorno->condicoes_credito); if ($retorno) { $nsInss = new Zend_Session_Namespace('condicoes_credito'); $nsInss->condicoes_credito = $retorno; $nsInss->condicoes_credito->api = $serviceInss->getBancoFromClass($origemConsulta); $nsInss->condicoes_credito->simulacao_id = $service->getSimulacaoExistenteId(); $nsInss->condicoes_credito->base_id = $service->getDados()['cliente_id']; $nsInss->condicoes_credito->banco_id = Model_Banco::bancoPorNome($origemConsulta); $this->_helper->json([ 'success' => true, 'valor_liberado' => number_format($retorno->valor_liquido, 2,',','.'), 'valor_financiado' => number_format($retorno->valor_financiado, 2,',','.'), 'taxa_juros' => number_format($retorno->taxa_referencia_mensal, 2,',','.'), 'valor_parcela' => number_format($retorno->valor_parcela, 2,',','.'), 'prazo' => $retorno->prazo, 'origem_consulta' => $origemConsulta ]); } $service->liberarStatusAtendimento($service->getSimulacaoExistenteId()); $service->notificarLeadContratacaoIncompletaInss($dados['nome'], null, $dados['fone']); $this->_helper->json(['success' => true]); } catch (Zend_Db_Statement_Exception $e) { $service->notificarLeadContratacaoIncompletaInss($dados['nome'], null, $dados['fone']); $service->notificarErroParaYuppie("Erro de banco na autocontratação INSS", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); Yuppie_Log::write("Dados enviados estão incompletos! " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $this->_helper->json(['error' => "Dados enviados estão incompletos!" . $e->getMessage()]); } catch (Core_Exception $e) { if ($serviceInss->getNotifica()) { $service->notificarLeadContratacaoIncompletaInss($dados['nome'], $e->getMessage(), $dados['fone']); } Yuppie_Log::write($e->getMessage(), $this); $this->_helper->json(['error' => $e->getMessage(), 'back' => $e->getCode()]); } catch (Throwable $throwable) { $service->notificarLeadContratacaoIncompletaInss($dados['nome'], null, $dados['fone']); $service->notificarErroParaYuppie("Erro na autocontratação INSS", $throwable->getMessage() . "<br><br>" . $throwable->getTraceAsString()); Yuppie_Log::write("Erro interno no sistema " . $throwable->getMessage() . "\n" . $throwable->getTraceAsString(), $this); $this->_helper->json(['error' => "Erro interno no sistema. "]); } } public function inclusaoInssAction() { $request = $this->getRequest(); $post = $request->getParams(); $nsInss = new Zend_Session_Namespace('condicoes_credito'); $serviceInss = $nsInss->condicoes_credito->api; $bancoId = $nsInss->condicoes_credito->banco_id; if (empty($serviceInss)) { $this->_helper->json([ 'error' => 'Existe uma instabilidade no ' . $nsInss->origem_consulta . 'e sua simulação não foi processada corretamente. Recarregue a tela e tente novamente ou volte mais tarde!' ]); return; } try { $condicoesCredito = $nsInss->condicoes_credito; $service = new SimulacaoAbertaService(); $proposta = new Model_Proposta(['banco_id' => $bancoId]); $propostaId = $proposta->saveByInclusaoAutocontratacao($post, $condicoesCredito, 'INSS'); $efetivado = null; if ($propostaId) { $retornoInclusao = $serviceInss->inclusaoConsignado($post, (array)$condicoesCredito, $propostaId); $serviceInss->tratarMensagemErro($condicoesCredito->base_id, $retornoInclusao, 'INSS'); Yuppie_Log::write(print_r($retornoInclusao, true), $this); $service->marcarAtendimentoDigitado($nsInss->condicoes_credito->simulacao_id); $efetivado = (new Model_Proposta())->efetivarPropostaInclusao($propostaId, current($retornoInclusao)); $serviceInss->enviarLinkFormalizacao(current($retornoInclusao)->numero_proposta ?? null, $post['cpf'], $post['fone']); } if (empty($efetivado)) { Yuppie_Log::write("Houve um erro ao efetivar a proposta. " . print_r(['post' => $post, 'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true), $this); $service->notificarErroParaYuppie("Erro na autocontratação ao efetivar a proposta", print_r(['post' => $post,'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true)); $service->adicionarPendencia($propostaId, "Erro na autocontratação ao efetivar a proposta"); $this->_helper->json(['error' => 'Houve um erro ao efetivar a proposta.']); return; } $resultMsg = [ 'success' => 'Dados enviados com sucesso!<br/><br/>', 'description' => 'Você receberá um SMS para envio dos seus documentos. <br/><br/>' . 'Para concluir, acesse o link enviado pelo banco para o número de celular que você informou.' ]; Yuppie_Log::write(print_r($resultMsg, true), $this); $service->notificarErroParaYuppie("Autocontratação efetuada com sucesso!", "Dados da autocontratação: <br><br>" . print_r(['post' => $post, 'retorno' => $retornoInclusao, 'condicoes_credito' => $condicoesCredito], true)); $this->_helper->json($resultMsg); } catch (Core_Exception $e) { Yuppie_Log::write("Houve um erro ao enviar a proposta. " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $service->notificarErroParaYuppie("Erro na autocontratação ao enviar a proposta", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); $service->adicionarPendencia($propostaId, $e->getMessage()); $this->_helper->json([ 'error' => 'Houve um erro ao enviar a proposta.', 'description' => $e->getMessage() ]); } catch (Throwable $e) { Yuppie_Log::write("Falha na inclusão de propostas: " . $e->getMessage() . "\n" . $e->getTraceAsString(), $this); $service->notificarErroParaYuppie("Erro na autocontratação na inclusão da proposta", $e->getMessage() . "<br><br>" . $e->getTraceAsString()); $service->adicionarPendencia($propostaId, $e->getMessage()); $this->_helper->json([ 'error' => 'Erro!', 'description' => 'Falha na inclusão da proposta! Tente novamente mais tarde.' ]); } } }
💾 保存文件
← 返回文件管理器