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.
64 lines
2.3 KiB
64 lines
2.3 KiB
<?php |
|
|
|
require_once 'ISPIntegrator.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()); |
|
|
|
$isp = new ISPIntegrator(CONF_USER_API, CONF_PASSWORD_API, CONF_URL_API); |
|
$isp->db()->setRegistros($registros); |
|
|
|
$codcli = $isp->agi()->get_variable('CODCLI', true); |
|
|
|
$itgcTela = array( |
|
"DOCUMENTO" => utf8_decode($isp->agi()->get_variable('DOCUMENTO', true)), |
|
"NOME" => utf8_decode($isp->agi()->get_variable('NOME', true)), |
|
"PLANO" => utf8_decode($isp->agi()->get_variable('PLANO', true)), |
|
"BLOQUEADO" => utf8_decode($isp->agi()->get_variable('BLOQUEADO', true)), |
|
"CIDADE" => utf8_decode($isp->agi()->get_variable('CIDADE', true)), |
|
"BAIRRO" => utf8_decode($isp->agi()->get_variable('BAIRRO', true)) |
|
); |
|
$isp->integracaoAgente($itgcTela, array('DOCUMENTO', 'NOME', 'PLANO', 'BLOQUEADO', 'CIDADE', 'BAIRRO')); |
|
|
|
if (CONF_AUDIO_ERROR) { |
|
$isp->db()->setIdAudioError(CONF_AUDIO_ERROR); |
|
} |
|
|
|
$retorno = $isp->listaDetalhesServico($codcli); |
|
$groupService = array(); |
|
|
|
if ($retorno['data']['results'][0]['planos']) { |
|
$retornos = $retorno['data']['results'][0]['planos']; |
|
$groupService[] = trim(strtoupper(str_replace('Serviço', '', utf8_decode($retornos['descri_est'])))); |
|
} else { |
|
$retornos = $retorno['data']['results']['planos']; |
|
foreach ($retornos as $plano) { |
|
$service = trim(strtoupper(str_replace('Serviço', '', utf8_decode($plano['descri_est'])))); |
|
if (!in_array($service, $groupService)) { |
|
$groupService[] = $service; |
|
} |
|
} |
|
} |
|
|
|
$isp->log()->debug('Servico: ' . print_r($groupService, true)); |
|
|
|
if (in_array('SUSPENSO POR DÉBITO', $groupService)) { |
|
$isp->agi()->exec_goto($isp->db()->getAnuncio('INT_SERVICO_SUSPENSO')); |
|
} else if (in_array('HABILITADO', $groupService)) { |
|
$isp->agi()->exec_goto($isp->db()->getURA('INT_ATENDIMENTO')); |
|
} else { |
|
$isp->agi()->exec_goto($isp->db()->getAnuncio('INT_SERVICO_NAO_LOCALIZADA')); |
|
} |
|
|
|
$isp->db()->atualizaIntegracao(); |
|
?> |
|
|
|
|