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.
53 lines
1.2 KiB
53 lines
1.2 KiB
<?php |
|
|
|
require "SGP.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()); |
|
|
|
$sgp = new SGP(CONF_TOKEN_API, CONF_URL_API, CONF_USERID_API, CONF_LOGGER_ATIVO); |
|
$sgp->db()->setRegistros($registros); |
|
|
|
|
|
$documento = $sgp->agi()->get_variable('DOCUMENTO', true); |
|
|
|
$clienteDados = $sgp->identificarDocumento($documento); |
|
|
|
|
|
if (CONF_AUDIO_ERROR) { |
|
$sgp->db()->setIdAudioError(CONF_AUDIO_ERROR); |
|
} |
|
|
|
$pendente = false; |
|
|
|
foreach($clienteDados['contratos'] as $cliente){ |
|
$faturas = $sgp->segundaVia($cliente['contratoId']); |
|
|
|
foreach ($faturas['links'] as $faturadata) { |
|
|
|
$datavencimento = $faturadata['vencimento_original'] . ' 23:59:59'; |
|
|
|
if (strtotime($datavencimento) < time()) { |
|
$pendente = true; |
|
} |
|
} |
|
} |
|
|
|
if($pendente){ |
|
$sgp->agi()->exec_goto($sgp->db()->getAnuncio('INT_PENDENCIA')); |
|
}else{ |
|
$sgp->agi()->exec_goto($sgp->db()->getURA('INT_AUTOMATIZADA')); |
|
} |
|
|
|
$sgp->db()->atualizaIntegracao(); |
|
|
|
?>
|