giansalex / lycet

API REST de Facturación Electrónica Sunat utilizando Greenter.
MIT License
82 stars 43 forks source link

Error al enviar comprobante despues de haber generado nota de credito #450

Closed MaxAntony closed 2 years ago

MaxAntony commented 3 years ago

Hola, hay un error al momento de generar un comprobante

Pasos para reproducir el error

este es el json que me retorna en el ultimo envio del comprobante:

{
    "xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<DebitNote xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:DebitNote-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:ext=\"urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2\"><ext:UBLExtensions><ext:UBLExtension><ext:ExtensionContent><ds:Signature Id=\"GreenterSign\"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/><ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><ds:Reference URI=\"\"><ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><ds:DigestValue>SJVOXXLsCHD2QjujzbY2GUwZbcA=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>IZ6srSd6djR75MU5okuZrPlHhLxhMRfsPSaR23+ox2Hl2snxuUgMpdgjIcs27KIH1pffu0ASccp38OJaR3VKCY0BOXVGHPvrjfmUZJNU4EOA/zWaK92Hg+9v8gBDZfvn5BYQaSyuXOX3Q5Yx1ezlPmjDZYkWir+Y+HAfpw+RK7O5grsyBjAg+TMFVEHwumYptyB5BNiDhS8WNVEKe4UUVZezuyzmpP/hHBADGFLeSrf4Huea1LNsrCXjcBLzYVIIio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L3NoYTIvY2FjbGFzczEuY3JsMDWgM6Axhi9odHRwOi8vY3JsMi5yZW5pZWMuZ29iLnBlL2NybC9zaGEyL2NhY2xhc3MxLmNybDAdBgNVHQ4EFgQUHIcjV0iY5ySZDdf980wHMfqtUacwDgYDVR0PAQH/BAQDAgbAMA0GCSqGSIb3DQEBCwUAA4ICAQBwCzykptQVwhOaCfZYLm6krf6TrIguEpA+nyOTKXmDkIaVbQckn3i/JRDc7PVvGvxbWfFEXxsgdSKnpM73uNc5hHf0EO+UHpCrHFVIhoreApwwo/fY0ueQci2m/FYSOjIM1j8Tf8CofmHxuetjLahu52Y6+ru15UtSc3YKb96rC7NXpJ8VLr+vujQY8lgLCI3XXBpFYrxJ6K2uGrMrdUo6bdi8ZDvdeQwt4W/GuqZK2iwXCl3WdODsiqtzSaK3U14GmY2/2RKQjdJkFryUjLVEWS0EBFUzebD1Oep3NMsTnjslrrORxUNlrwzeF5oCIW6b1l5vgc7gqXiJHCsq+1gsXV8+YlRwR7m2mZCmueyKikbGEJwzdJraDzvFiImRrC/RjDfWO3ChLOIAfU9PiDhppu3elxb0YzIE3I8N3dgOR6B/uZaHjMOkgsjWupMFALpJAyHTlLkm8X/mey1ZHb4WY0kXGd244eVXbGHP18S+dwLRRyve8T/nS0ljFpTi4HFr5p9yB4z0O8RW3ISkb1m4KcZ8ODnZv0MKMDpGeTu+IYnKac3fLc3FAJ5ANzr1D794g9bjXPQPdRFbLesnJ1FnA/LJt3aa2bpFd9Kxw06BO6znoHok4BQEx1YV0jvMI+NwJR8iqZE6o4GLC+5t2LtAb3CAljovDmNOwYyuev3iOg==</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions><cbc:UBLVersionID>2.1</cbc:UBLVersionID><cbc:CustomizationID>2.0</cbc:CustomizationID><cbc:ID>F001-111</cbc:ID><cbc:IssueDate>2021-02-06</cbc:IssueDate><cbc:IssueTime>12:34:00</cbc:IssueTime><cbc:Note languageLocaleID=\"1000\"><![CDATA[SON CIENTO DIECIOCHO CON 00/100 SOLES]]></cbc:Note><cbc:DocumentCurrencyCode>PEN</cbc:DocumentCurrencyCode><cac:DiscrepancyResponse><cbc:ReferenceID/><cbc:ResponseCode/><cbc:Description/></cac:DiscrepancyResponse><cac:BillingReference><cac:InvoiceDocumentReference><cbc:ID/><cbc:DocumentTypeCode/></cac:InvoiceDocumentReference></cac:BillingReference><cac:Signature><cbc:ID>20123456789</cbc:ID><cac:SignatoryParty><cac:PartyIdentification><cbc:ID>20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[LYCET COMPANY SAC]]></cbc:Name></cac:PartyName></cac:SignatoryParty><cac:DigitalSignatureAttachment><cac:ExternalReference><cbc:URI>#GREENTER-SIGN</cbc:URI></cac:ExternalReference></cac:DigitalSignatureAttachment></cac:Signature><cac:AccountingSupplierParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID=\"6\">20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[COMPANY ]]></cbc:Name></cac:PartyName><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[LYCET COMPANY SAC]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150101</cbc:ID><cbc:AddressTypeCode>0000</cbc:AddressTypeCode><cbc:CitySubdivisionName>-</cbc:CitySubdivisionName><cbc:CityName>LIMA</cbc:CityName><cbc:CountrySubentity>LIMA</cbc:CountrySubentity><cbc:District>LIMA</cbc:District><cac:AddressLine><cbc:Line><![CDATA[AV ITALIA]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity></cac:Party></cac:AccountingSupplierParty><cac:AccountingCustomerParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID=\"6\">20546687668</cbc:ID></cac:PartyIdentification><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[COMPANY SAC]]></cbc:RegistrationName></cac:PartyLegalEntity></cac:Party></cac:AccountingCustomerParty><cac:TaxTotal><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID=\"PEN\">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:RequestedMonetaryTotal><cbc:PayableAmount currencyID=\"PEN\">118.00</cbc:PayableAmount></cac:RequestedMonetaryTotal><cac:DebitNoteLine><cbc:ID>1</cbc:ID><cbc:DebitedQuantity unitCode=\"NIU\">1</cbc:DebitedQuantity><cbc:LineExtensionAmount currencyID=\"PEN\">100.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID=\"PEN\">118</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID=\"PEN\">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[PRODUCTO 1]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>string</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID=\"PEN\">100</cbc:PriceAmount></cac:Price></cac:DebitNoteLine></DebitNote>\n",
    "hash": "SJVOXXLsCHD2QjujzbY2GUwZbcA=",
    "sunatResponse": {
        "success": false,
        "error": {
            "code": "0306",
            "message": "No se puede leer (parsear) el archivo XML - Detalle: http://xxx.xxx.xxx/ol-ti-itcpfegem-beta/billService: cvc-wildcard 2: unrecognized element {urn:oasis:names:specification:ubl:schema:xsd:DebitNote-2}DebitNote"
        }
    }
}

al parecer genera el xml de una nota de debito el cual genera el error

tambien haciendo unas pruebas enviando comprobantes y despues una nota de credito obtuve el mismo error

{
    "xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:ext=\"urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2\"><ext:UBLExtensions><ext:UBLExtension><ext:ExtensionContent><ds:Signature Id=\"GreenterSign\"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/><ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><ds:Reference URI=\"\"><ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><ds:DigestValue>eTVRpihTdoLffMJ2SfYgzcdPphY=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>tExZ5f8JM86vBNEKflD51gr7ChFW+YKWDFj1M5QZkdDuARiVw0Nx/7eZd4RXX3005VbdcVESEgndx6Sy8gJIaQofEKWPrscPDUyuAt53jaxayskzrMRXS7SPJqAfSm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kAZQBuAHQAbwAgAGQAZQBsACAARABMACAATgC6ACAAMQAzADcAMDATBgNVHSUEDDAKBggrBgEFBQcDBDB2BgNVHR8EbzBtMDSgMqAwhi5odHRwOi8vY3JsLnJlbmllYy5nb2IucGUvY3JsL3NoYTIvY2FjbGFzczEuY3JsMDWgM6Axhi9odHRwOi8vY3JsMi5yZW5pZWMuZ29iLnBlL2NybC9zaGEyL2NhY2xhc3MxLmNybDAdBgNVHQ4EFgQUHIcjV0iY5ySZDdf980wHMfqtUacwDgYDVR0PAQH/BAQDAgbAMA0GCSqGSIb3DQEBCwUAA4ICAQBwCzykptQVwhOaCfZYLm6krf6TrIguEpA+nyOTKXmDkIaVbQckn3i/JRDc7PVvGvxbWfFEXxsgdSKnpM73uNc5hHf0EO+UHpCrHFVIhoreApwwo/fY0ueQci2m/FYSOjIM1j8Tf8CofmHxuetjLahu52Y6+ru15UtSc3YKb96rC7NXpJ8VLr+vujQY8lgLCI3XXBpFYrxJ6K2uGrMrdUo6bdi8ZDvdeQwt4W/GuqZK2iwXCl3WdODsiqtzSaK3U14GmY2/2RKQjdJkFryUjLVEWS0EBFUzebD1Oep3NMsTnjslrrORxUNlrwzeF5oCIW6b1l5vgc7gqXiJHCsq+1gsXV8+YlRwR7m2mZCmueyKikbGEJwzdJraDzvFiImRrC/RjDfWO3ChLOIAfU9PiDhppu3elxb0YzIE3I8N3dgOR6B/uZaHjMOkgsjWupMFALpJAyHTlLkm8X/mey1ZHb4WY0kXGd244eVXbGHP18S+dwLRRyve8T/nS0ljFpTi4HFr5p9yB4z0O8RW3ISkb1m4KcZ8ODnZv0MKMDpGeTu+IYnKac3fLc3FAJ5ANzr1D794g9bjXPQPdRFbLesnJ1FnA/LJt3aa2bpFd9Kxw06BO6znoHok4BQEx1YV0jvMI+NwJR8iqZE6o4GLC+5t2LtAb3CAljovDmNOwYyuev3iOg==</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions><cbc:UBLVersionID>2.1</cbc:UBLVersionID><cbc:CustomizationID>2.0</cbc:CustomizationID><cbc:ID>FF01-1</cbc:ID><cbc:IssueDate>2021-01-31</cbc:IssueDate><cbc:IssueTime>15:30:00</cbc:IssueTime><cbc:InvoiceTypeCode listID=\"\">07</cbc:InvoiceTypeCode><cbc:Note languageLocaleID=\"1000\"><![CDATA[SON CIEN CON 00/100 SOLES]]></cbc:Note><cbc:DocumentCurrencyCode>PEN</cbc:DocumentCurrencyCode><cac:Signature><cbc:ID>20123456789</cbc:ID><cac:SignatoryParty><cac:PartyIdentification><cbc:ID>20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[LYCET COMPANY SAC]]></cbc:Name></cac:PartyName></cac:SignatoryParty><cac:DigitalSignatureAttachment><cac:ExternalReference><cbc:URI>#GREENTER-SIGN</cbc:URI></cac:ExternalReference></cac:DigitalSignatureAttachment></cac:Signature><cac:AccountingSupplierParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID=\"6\">20123456789</cbc:ID></cac:PartyIdentification><cac:PartyName><cbc:Name><![CDATA[COMPANY ]]></cbc:Name></cac:PartyName><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[LYCET COMPANY SAC]]></cbc:RegistrationName><cac:RegistrationAddress><cbc:ID>150101</cbc:ID><cbc:AddressTypeCode>0000</cbc:AddressTypeCode><cbc:CitySubdivisionName>-</cbc:CitySubdivisionName><cbc:CityName>LIMA</cbc:CityName><cbc:CountrySubentity>LIMA</cbc:CountrySubentity><cbc:District>LIMA</cbc:District><cac:AddressLine><cbc:Line><![CDATA[AV ITALIA]]></cbc:Line></cac:AddressLine><cac:Country><cbc:IdentificationCode>PE</cbc:IdentificationCode></cac:Country></cac:RegistrationAddress></cac:PartyLegalEntity></cac:Party></cac:AccountingSupplierParty><cac:AccountingCustomerParty><cac:Party><cac:PartyIdentification><cbc:ID schemeID=\"6\">20546687668</cbc:ID></cac:PartyIdentification><cac:PartyLegalEntity><cbc:RegistrationName><![CDATA[COMPANY SAC]]></cbc:RegistrationName></cac:PartyLegalEntity></cac:Party></cac:AccountingCustomerParty><cac:TaxTotal><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID=\"PEN\">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxCategory><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:LegalMonetaryTotal><cbc:LineExtensionAmount currencyID=\"PEN\">100.00</cbc:LineExtensionAmount><cbc:PayableAmount currencyID=\"PEN\">118.00</cbc:PayableAmount></cac:LegalMonetaryTotal><cac:InvoiceLine><cbc:ID>1</cbc:ID><cbc:InvoicedQuantity unitCode=\"NIU\">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID=\"PEN\">100.00</cbc:LineExtensionAmount><cac:PricingReference><cac:AlternativeConditionPrice><cbc:PriceAmount currencyID=\"PEN\">118</cbc:PriceAmount><cbc:PriceTypeCode>01</cbc:PriceTypeCode></cac:AlternativeConditionPrice></cac:PricingReference><cac:TaxTotal><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID=\"PEN\">100.00</cbc:TaxableAmount><cbc:TaxAmount currencyID=\"PEN\">18.00</cbc:TaxAmount><cac:TaxCategory><cbc:Percent>18</cbc:Percent><cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode><cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:Item><cbc:Description><![CDATA[PRODUCTO 1]]></cbc:Description><cac:SellersItemIdentification><cbc:ID>string</cbc:ID></cac:SellersItemIdentification></cac:Item><cac:Price><cbc:PriceAmount currencyID=\"PEN\">100</cbc:PriceAmount></cac:Price></cac:InvoiceLine></Invoice>\n",
    "hash": "eTVRpihTdoLffMJ2SfYgzcdPphY=",
    "sunatResponse": {
        "success": false,
        "error": {
            "code": "0306",
            "message": "No se puede leer (parsear) el archivo XML - Detalle: http://xxx.xxx.xxx/ol-ti-itcpfegem-beta/billService: cvc-wildcard 2: unrecognized element {urn:oasis:names:specification:ubl:schema:xsd:Invoice-2}Invoice"
        }
    }
}

deberia haber generado el xml para una nota de credito pero en cambio genero para un comprobante

giansalex commented 3 years ago

No tengo disponibilidad para revisar la causa, pero se que estos problemas han aparecido desde que se usa php-pm, puedes probar con este Dockerfile previo

rayo80 commented 2 years ago

Hola alguna actualizacion sobre este problema :/ ... Una vez sucede este error(se envia la nota de credito) los envios de boletas y facturas "send" fallan siempre ya que el xml que se empieza a generar es el de una nota de debito. Para detener este bug no queda otra que reiniciar el contenedor. Intente con el Dockerfile en apache pero me sale forbidden :c

giansalex commented 2 years ago

@rayo80 He revisado el tema, y probablemente el error este en esta parte de los controladores. https://github.com/giansalex/lycet/blob/66d6865b7fbdab2582c7222cc28aec767ebea35d/src/Controller/v1/InvoiceController.php#L36

Debido a que php-pm no reinicia la aplicación, estos controladores solo se inicializan en la primera llamada, eso explicaría el caso de arriba, en el orden de llamadas:

InvoiceController -> llama al constructor y setea como documento Invoice
NoteController -> llama al constructor y setea como documento Note (Credito/Debito),
InvoiceController -> no llama al constructor y se mantiene el documento anterior (Note)

La solucion seria mover esa parte a los "Actions"

    public function send(): Response
    {
        $this->document->setDocumentType(Invoice::class);
        return $this->document->send();
    }

o refactorizar este archivo para incluirlo como parámetro

    public function send(): Response
    {
        return $this->document->send(Invoice::class);
    }
giansalex commented 2 years ago

Parece que hay una opción más sencilla de corregir esto @rayo80 puedes construir la imagen desde esta rama

git pull
git checkout recreate-controllers

https://github.com/giansalex/lycet/tree/recreate-controllers

rayo80 commented 2 years ago

Buenas Gian de momento ya no tengo ningun problema. Lo que hiciste al poner shared: False en services.yaml es que las peticiones ya no compartan nada de estructura o algo asi?(pregunto por curiosidad y con intuicion nomas ya que de php solo se wordpress XD) Gracias por la ayuda

giansalex commented 2 years ago

@rayo80 en realidad solo volverá a crear los controllers, que es donde radica el problema de este caso. El enfoque con php-pm difiere del comportamiento de los web servers tradicionales de php, por eso han aparecido estos problemas.