Skip to content

Instantly share code, notes, and snippets.

@marcaum54
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcaum54/10024466 to your computer and use it in GitHub Desktop.
Save marcaum54/10024466 to your computer and use it in GitHub Desktop.
<?php
try
{
$x = new SoapClient((string)$this->url);
}
catch (SoapFault $e)
{
$this->setMessage('Servidor Indisponivel. Por favor, entre em contato com nosso setor financeiro.');
$this->setRedirect('index.php?option=com_ag&view=login');
return false;
}
//Obtendo conta e sequencial
$infoBoleto = explode(';', $boleto);
//Obtendo Renegociação (atributos estão com letras maiusculas pq assim foi definido no webservice)
$objRenegociar = new stdClass();
$objRenegociar->Empresa = $this->empresa;
$objRenegociar->ContasaReceber = $infoBoleto[0];
$objRenegociar->DataVencimento = $datab;
$objRenegociar->SequencialVencimento = $infoBoleto[1];
$objRenegociar->Juros = $novoJuros;
$objRenegociar->Multa = $novaMulta;
$objRenegociar->Desconto = 0;
try
{
$novoBoleto = $x->RenegociarCRE($objRenegociar);
}
catch (SoapFault $e)
{
$this->setMessage('Servidor Indisponivel. Por favor, entre em contato com nosso setor financeiro.');
$this->setRedirect('index.php?option=com_ag&view=login');
return false;
}
if(strlen($novoBoleto) > 11)
{
$this->setMessage('Ocorreu um erro ao gerar o seu boleto por favor tente mais tarde');
$this->setRedirect('index.php?option=com_ag&view=login');
die;
}
else
{
//Imprimindo PDF
header('Content-disposition: attachment; filename='.$file);
header('Content-type: application/pdf');
echo $x->GetBoletoPDF((string)$this->empresa, $datai, $dataf, $this->juros, $this->multa, $novoBoleto.';1');
die;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment