se corrige NIE021
FossilOrigin-Name: ae3eae5bc793a328a0fd65a7172f65a243ed87f1a616f390fba4d721a0864875
This commit is contained in:
		| @@ -118,9 +118,14 @@ class Proveedor: | |||||||
|     def post_apply(self, fexml, fragment): |     def post_apply(self, fexml, fragment): | ||||||
|         cune_xpath = fexml.xpath_from_root('/InformacionGeneral') |         cune_xpath = fexml.xpath_from_root('/InformacionGeneral') | ||||||
|         cune = fexml.get_element_attribute(cune_xpath, 'CUNE') |         cune = fexml.get_element_attribute(cune_xpath, 'CUNE') | ||||||
|         # TODO(bit4bit) https://catalogo‐vpfe‐hab.dian.gov.co/document/searchqr?documentkey=CUNE para habilitacion |          | ||||||
|         # https://catalogo‐vpfe.dian.gov.co/document/searchqr?documentkey=CUNE |         ambiente = fexml.get_element_attribute(fexml.xpath_from_root('/InformacionGeneral'), 'Ambiente') | ||||||
|         codigo_qr = f"https://catalogo‐vpfe-hab.dian.gov.co/document/searchqr?documentkey={cune}" |         codigo_qr = f"https://catalogo-vpfe.dian.gov.co/document/searchqr?documentkey={cune}" | ||||||
|  |  | ||||||
|  |         if InformacionGeneral.AMBIENTE_PRUEBAS.same(ambiente): | ||||||
|  |             codigo_qr = f"https://catalogo-vpfe-hab.dian.gov.co/document/searchqr?documentkey={cune}" | ||||||
|  |         elif ambiente is None: | ||||||
|  |             raise RuntimeError('fail to get InformacionGeneral/@Ambiente') | ||||||
|          |          | ||||||
|         fexml.set_element('./CodigoQR', codigo_qr) |         fexml.set_element('./CodigoQR', codigo_qr) | ||||||
|  |  | ||||||
| @@ -181,17 +186,29 @@ class TipoMoneda: | |||||||
|  |  | ||||||
| @dataclass | @dataclass | ||||||
| class InformacionGeneral: | class InformacionGeneral: | ||||||
|  |     @dataclass | ||||||
|     class TIPO_AMBIENTE: |     class TIPO_AMBIENTE: | ||||||
|         pass |         valor: str | ||||||
|  |  | ||||||
|  |         @classmethod | ||||||
|  |         def same(cls, value): | ||||||
|  |             return cls.valor == str(value) | ||||||
|  |  | ||||||
|     # TABLA 5.1.1 |     # TABLA 5.1.1 | ||||||
|     @dataclass |     @dataclass | ||||||
|     class AMBIENTE_PRODUCCION(TIPO_AMBIENTE): |     class AMBIENTE_PRODUCCION(TIPO_AMBIENTE): | ||||||
|         valor: str = '1' |         valor: str = '1' | ||||||
|  |  | ||||||
|  |         def __str__(self): | ||||||
|  |             self.valor | ||||||
|  |  | ||||||
|     @dataclass |     @dataclass | ||||||
|     class AMBIENTE_PRUEBAS(TIPO_AMBIENTE): |     class AMBIENTE_PRUEBAS(TIPO_AMBIENTE): | ||||||
|         valor: str = '2' |         valor: str = '2' | ||||||
|  |  | ||||||
|  |         def __str__(self): | ||||||
|  |             self.valor | ||||||
|  |  | ||||||
|     fecha_generacion: typing.Union[str, Fecha] |     fecha_generacion: typing.Union[str, Fecha] | ||||||
|     hora_generacion: str |     hora_generacion: str | ||||||
|     periodo_nomina: PeriodoNomina |     periodo_nomina: PeriodoNomina | ||||||
|   | |||||||
| @@ -221,7 +221,7 @@ def test_nomina_xml(): | |||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@SoftwareID') == 'xx' |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@SoftwareID') == 'xx' | ||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@fachoSoftwareSC') == 'xx12N00001' |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@fachoSoftwareSC') == 'xx12N00001' | ||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@SoftwareSC') is not None |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/ProveedorXML/@SoftwareSC') is not None | ||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/CodigoQR') == f"https://catalogo‐vpfe-hab.dian.gov.co/document/searchqr?documentkey={expected_cune}" |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/CodigoQR') == f"https://catalogo-vpfe.dian.gov.co/document/searchqr?documentkey={expected_cune}" | ||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/Empleador/@NIT') == '700085371' |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/Empleador/@NIT') == '700085371' | ||||||
|     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/Trabajador/@NumeroDocumento') == '800199436' |     assert xml.get_element_text_or_attribute('/fe:NominaIndividual/Trabajador/@NumeroDocumento') == '800199436' | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user