public function sefazManifesta($chNFe = '', $tpAmb = '2', $xJust = '', $tpEvento = '', &$aRetorno = array())
{
$chNFe = preg_replace('/[^0-9]/', '', $chNFe);
$tpEvento = preg_replace('/[^0-9]/', '', $tpEvento);
$tagAdic = '';
switch ($tpEvento) {
case '210200':
//210200 – Confirmação da Operação
break;
case '210210':
//210210 – Ciência da Operação
break;
case '210220':
//210220 – Desconhecimento da Operação
break;
case '210240':
//210240 – Operação não Realizada
if (strlen($xJust) < 15 || strlen($xJust) > 255) {
$msg = "É obrigatória uma justificativa com 15 até 255 caracteres!!";
throw new Exception\InvalidArgumentException($msg);
}
$xJust = Strings::cleanString($xJust);
$tagAdic = "<xJust>{$xJust}</xJust>";
break;
default:
$msg = "Esse código de tipo de evento não consta!! {$tpEvento}";
throw new Exception\InvalidArgumentException($msg);
}
$siglaUF = 'AN';
$nSeqEvento = '1';
$retorno = $this->zSefazEvento($siglaUF, $chNFe, $tpAmb, $tpEvento, $nSeqEvento, $tagAdic);
$aRetorno = $this->aLastRetEvent;
return $retorno;
}