protected function gerarNossoNumero()
{
$convenio = $this->getConvenio();
$numero_boleto = $this->getNumeroDocumento();
switch (strlen($convenio)) {
case 4:
$numero = Util::numberFormatGeral($convenio, 4) . Util::numberFormatGeral($numero_boleto, 7);
break;
case 6:
if (in_array($this->getCarteira(), ['16', '18']) && $this->getVariacaoCarteira() == 17) {
$numero = Util::numberFormatGeral($numero_boleto, 17);
} else {
$numero = Util::numberFormatGeral($convenio, 6) . Util::numberFormatGeral($numero_boleto, 5);
}
break;
case 7:
$numero = Util::numberFormatGeral($convenio, 7) . Util::numberFormatGeral($numero_boleto, 10);
break;
default:
throw new \Exception('O código do convênio precisa ter 4, 6 ou 7 dígitos!');
}
return $numero;
}