forked from Claudio/integracao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
<?php |
|
|
|
include 'HubSoft.php'; |
|
|
|
$registros = array( |
|
"id" => '', |
|
"reg_ura" => $ura, |
|
"reg_tronco" => $tronco, |
|
"reg_uniqueid" => $uid, |
|
"reg_id_metodo" => $idMetodo, |
|
"reg_uniqueid" => $uid, |
|
"reg_uniqueid_old" => $uidOld, |
|
"reg_fone" => $numero, |
|
"reg_status_exec" => '1', |
|
"reg_inicio" => date()); |
|
|
|
$hub = new HubSoft( |
|
CONF_URL_API, |
|
CONF_USERID_API, |
|
CONF_TOKEN_API, |
|
CONF_USER_API, |
|
CONF_PASSWORD_API, |
|
CONF_LOGGER_ATIVO |
|
); |
|
|
|
$hub->db()->setRegistros($registros); |
|
|
|
if (CONF_AUDIO_ERROR) { |
|
$hub->db()->setIdAudioError(CONF_AUDIO_ERROR); |
|
} |
|
|
|
$documento = $hub->agi()->get_variable('URA', true); |
|
$retorno = $hub->identificarDocumento($documento); |
|
$reg_pass = $hub->agi()->get_variable("REG_PASS", true); |
|
|
|
// INFORMACOES ESSENCIAIS |
|
$hub->agi()->set_variable('CODCLIENTE', $retorno['clientes'][0]['codigo_cliente']); |
|
$hub->agi()->set_variable('IDCLIENTESERVICO', $retorno['clientes'][0]['servicos'][0]['id_cliente_servico']); |
|
$hub->agi()->set_variable('NOME', $retorno['clientes'][0]['nome_razaosocial']); |
|
$hub->agi()->set_variable('TELEFONEPRIMARIO', $retorno['clientes'][0]['telefone_primario']); |
|
|
|
// INTEGRACAO DE TELA |
|
|
|
$hub->agi()->set_variable('CPF_CNPJ', $documento); |
|
$hub->agi()->set_variable('BAIRRO', $retorno['clientes'][0]['servicos'][0]['endereco_cadastral']['bairro']); |
|
$hub->agi()->set_variable('STATUS', $retorno['clientes'][0]['servicos'][0]['status']); |
|
$hub->agi()->set_variable('IPV4', $retorno['clientes'][0]['servicos'][0]['ipv4']); |
|
$qtdServicos = sizeof($retorno['clientes'][0]['servicos']); |
|
$hub->agi()->set_variable('CONECTADO', $retorno['clientes'][0]['servicos'][0]['ultima_conexao']['conectado'].' - '.$qtdServicos. ' Contratos'); |
|
|
|
if ($retorno['clientes']) { |
|
$hub->agi()->exec_goto($hub->db()->getAnuncio('INT_CADASTRO_SUCESSO')); // Sucesso |
|
} else if ($reg_pass <= 1) { |
|
$reg_pass += 1; |
|
$hub->agi()->set_variable("REG_PASS", $reg_pass); |
|
$hub->agi()->exec_goto($hub->db()->getAnuncio('INT_CADASTRO_FALHA')); // Falha |
|
} else { |
|
$hub->agi()->exec_goto($hub->db()->getAnuncio('INT_TRANSFERE_ATENDIMENTO')); |
|
} |
|
$hub->db()->atualizaIntegracao(); |
|
?>
|