Olá, ao tentar cancelar um MDFe que foi gerado a partir de um E-CPF me deparei com a seguinte mensagem:
Status Codigo = 202
Status Descrição: Rejeição: CPF do Emitente difere do CPF do Certificado Digital
Fiz uma alteração dentro de ACBRMDFE.pas:
function TACBrMDFe.Cancelamento(const AJustificativa: String; ALote: integer = 0): Boolean;
var
i: integer;
begin
if Manifestos.Count = 0 then
GerarException(ACBrStr('ERRO: Nenhum MDF-e Informado!'));
for i := 0 to Manifestos.Count - 1 do
begin
WebServices.Consulta.MDFeChave := Manifestos.Items.NumID;
if not WebServices.Consulta.Executar then
raise Exception.Create(WebServices.Consulta.Msg);
EventoMDFe.Evento.Clear;
with EventoMDFe.Evento.New do
begin
infEvento.CNPJCPF := Manifestos.Items.MDFe.Emit.CNPJCPF; //mudei o que esta na linha de baixo pra isso aqui
// infEvento.CNPJCPF := copy(OnlyNumber(WebServices.Consulta.MDFeChave), 7, 14);
infEvento.cOrgao := StrToIntDef(copy(OnlyNumber(WebServices.Consulta.MDFeChave), 1, 2), 0);
infEvento.dhEvento := now;
infEvento.tpEvento := teCancelamento;
infEvento.chMDFe := WebServices.Consulta.MDFeChave;
infEvento.detEvento.nProt := WebServices.Consulta.Protocolo;
infEvento.detEvento.xJust := AJustificativa;
end;
try
EnviarEvento(ALote);
except
raise Exception.Create(WebServices.EnvEvento.EventoRetorno.xMotivo);
end;
end;
Result := True;
end;
Resolvido o problema.