correciones segun dian
FossilOrigin-Name: 4a7f379192aa3a17183e5c4f375dfceeb4044c436347c28d472a492621ea116f
This commit is contained in:
		| @@ -25,14 +25,17 @@ from .exception import * | |||||||
| @dataclass | @dataclass | ||||||
| class NumeroSecuencia: | class NumeroSecuencia: | ||||||
|     consecutivo: int |     consecutivo: int | ||||||
|     numero: str |     prefijo: str | ||||||
|  |  | ||||||
|     def apply(self, fragment): |     def apply(self, fragment): | ||||||
|  |         numero = f"{self.prefijo}{self.consecutivo}" | ||||||
|         fragment.set_attributes('./NumeroSecuenciaXML', |         fragment.set_attributes('./NumeroSecuenciaXML', | ||||||
|  |                                 # NIE010 | ||||||
|  |                                 Prefijo=self.prefijo, | ||||||
|                                 # NIE011 |                                 # NIE011 | ||||||
|                                 Consecutivo=self.consecutivo, |                                 Consecutivo=self.consecutivo, | ||||||
|                                 # NIE012 |                                 # NIE012 | ||||||
|                                 Numero = self.numero) |                                 Numero = numero) | ||||||
|  |  | ||||||
| @dataclass | @dataclass | ||||||
| class Periodo: | class Periodo: | ||||||
| @@ -64,7 +67,7 @@ class Proveedor: | |||||||
|     nit: str |     nit: str | ||||||
|     dv: int |     dv: int | ||||||
|     software_id: str |     software_id: str | ||||||
|     software_sc: str |     software_pin: str | ||||||
|  |  | ||||||
|     def apply(self, fragment): |     def apply(self, fragment): | ||||||
|         fragment.set_attributes('./ProveedorXML', |         fragment.set_attributes('./ProveedorXML', | ||||||
| @@ -74,8 +77,8 @@ class Proveedor: | |||||||
|                                 DV=self.dv, |                                 DV=self.dv, | ||||||
|                                 # NIE019 |                                 # NIE019 | ||||||
|                                 SoftwareID=self.software_id, |                                 SoftwareID=self.software_id, | ||||||
|                                 # NIE020 |  | ||||||
|                                 SoftwareSC=self.software_sc, |                                 SoftwareSC=None | ||||||
|                                 ) |                                 ) | ||||||
|  |  | ||||||
|     def post_apply(self, fexml, fragment): |     def post_apply(self, fexml, fragment): | ||||||
| @@ -83,9 +86,24 @@ class Proveedor: | |||||||
|         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 |         # 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 |         # https://catalogo‐vpfe.dian.gov.co/document/searchqr?documentkey=CUNE | ||||||
|         codigo_qr = f"https://catalogo‐vpfe.dian.gov.co/document/searchqr?documentkey={cune}" |         codigo_qr = f"https://catalogo‐vpfe-hab.dian.gov.co/document/searchqr?documentkey={cune}" | ||||||
|         fexml.set_element('./CodigoQR', codigo_qr) |         fexml.set_element('./CodigoQR', codigo_qr) | ||||||
|  |  | ||||||
|  |         # NIE020 | ||||||
|  |         software_code = self._software_security_code(fexml) | ||||||
|  |         fexml.set_attributes('./ProveedorXML', SoftwareSC=software_code) | ||||||
|  |  | ||||||
|  |     def _software_security_code(self, fexml): | ||||||
|  |         # 8.2 | ||||||
|  |         numero = fexml.get_element_text_or_attribute('./NumeroSecuenciaXML/@Numero') | ||||||
|  |         id_software = self.software_id | ||||||
|  |         software_pin = self.software_pin | ||||||
|  |  | ||||||
|  |         code = "".join([id_software, software_pin, numero]) | ||||||
|  |         h = hashlib.sha384() | ||||||
|  |         h.update(code.encode('utf-8')) | ||||||
|  |         return h.hexdigest() | ||||||
|  |      | ||||||
| @dataclass | @dataclass | ||||||
| class Metadata: | class Metadata: | ||||||
|     secuencia: NumeroSecuencia |     secuencia: NumeroSecuencia | ||||||
| @@ -144,7 +162,7 @@ class InformacionGeneral: | |||||||
|     def apply(self, fragment): |     def apply(self, fragment): | ||||||
|         fragment.set_attributes('./InformacionGeneral', |         fragment.set_attributes('./InformacionGeneral', | ||||||
|                                 # NIE022 |                                 # NIE022 | ||||||
|                                 Version = 'V1.0: Documento Soporte de Pago de Nómina ElectrónicaV1.0', |                                 Version = 'V1.0: Documento Soporte de Pago de Nómina Electrónica', | ||||||
|                                 # NIE023 |                                 # NIE023 | ||||||
|                                 Ambiente = self.tipo_ambiente.valor, |                                 Ambiente = self.tipo_ambiente.valor, | ||||||
|                                 # NIE202 |                                 # NIE202 | ||||||
| @@ -154,7 +172,7 @@ class InformacionGeneral: | |||||||
|                                 # NIE024 |                                 # NIE024 | ||||||
|                                 CUNE = None, |                                 CUNE = None, | ||||||
|                                 # NIE025 |                                 # NIE025 | ||||||
|                                 EncripCUNE = 'SHA-384', |                                 EncripCUNE = 'CUNE-SHA384', | ||||||
|                                 # NIE026 |                                 # NIE026 | ||||||
|                                 FechaGen = self.fecha_generacion, |                                 FechaGen = self.fecha_generacion, | ||||||
|                                 # NIE027 |                                 # NIE027 | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ class DeduccionFondoPension(Deduccion): | |||||||
|         fragment.set_element('./FondoPension', None, |         fragment.set_element('./FondoPension', None, | ||||||
|                              append_ = True, |                              append_ = True, | ||||||
|                              # NIE164 |                              # NIE164 | ||||||
|                              Porcentaje = self.porcentaje, |                              Porcentaje = str(round(self.porcentaje, 2)), | ||||||
|                              #  NIE166 |                              #  NIE166 | ||||||
|                              Deduccion = self.deduccion |                              Deduccion = self.deduccion | ||||||
|                              ) |                              ) | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ class DeduccionSalud(Deduccion): | |||||||
|         fragment.set_element('./Salud', None, |         fragment.set_element('./Salud', None, | ||||||
|                              append_ = True, |                              append_ = True, | ||||||
|                              # NIE161 |                              # NIE161 | ||||||
|                              Porcentaje = self.porcentaje, |                              Porcentaje = str(round(self.porcentaje, 2)), | ||||||
|                              #  NIE163 |                              #  NIE163 | ||||||
|                              Deduccion = self.deduccion |                              Deduccion = self.deduccion | ||||||
|                              ) |                              ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user