facho/fe/fe.py (DianXMLExtensionSoftwareProvider): nueva extension para SoftwareProvider
FossilOrigin-Name: 4a475ab0e79b851fcf5575d309f1d8c8c929488b37b9a1b77d2fa8e8fffea499
This commit is contained in:
parent
be9d1a37d5
commit
30fb9eec9f
@ -4,4 +4,5 @@ from .fe import DianXMLExtensionSigner
|
||||
from .fe import DianXMLExtensionSoftwareSecurityCode
|
||||
from .fe import DianXMLExtensionCUFE
|
||||
from .fe import DianXMLExtensionInvoiceAuthorization
|
||||
from .fe import DianXMLExtensionSoftwareProvider
|
||||
from .fe import DianZIP
|
||||
|
@ -113,6 +113,20 @@ class DianXMLExtensionCUFE(FachoXMLExtension):
|
||||
h.update(cufe.encode('utf-8'))
|
||||
return h.hexdigest()
|
||||
|
||||
|
||||
class DianXMLExtensionSoftwareProvider(FachoXMLExtension):
|
||||
# RESOLUCION 0004: pagina 108
|
||||
|
||||
def __init__(self, nit: str, id_software: str):
|
||||
self.nit = nit
|
||||
self.id_software = id_software
|
||||
|
||||
def build(self, fexml):
|
||||
software_provider = fexml.fragment('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/sts:DianExtensions/sts:SoftwareProvider')
|
||||
software_provider.set_element('/sts:SoftwareProvider/sts:ProviderID', self.nit)
|
||||
software_provider.set_element('/sts:SoftwareProvider/sts:SoftwareID', self.id_software)
|
||||
return '', []
|
||||
|
||||
|
||||
class DianXMLExtensionSoftwareSecurityCode(FachoXMLExtension):
|
||||
# RESOLUCION 0001: pagina 535
|
||||
|
@ -66,3 +66,15 @@ def test_dian_extension_invoice_authorization():
|
||||
xml.add_extension(inv_auth_ext)
|
||||
auth = xml.get_element_text('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/sts:DianExtensions/sts:InvoiceControl/sts:InvoiceAuthorization')
|
||||
assert auth == invoice_authorization
|
||||
|
||||
def test_dian_extension_software_provider():
|
||||
nit = '123456789'
|
||||
id_software = 'ABCDASDF123'
|
||||
software_provider_extension = fe.DianXMLExtensionSoftwareProvider(nit, id_software)
|
||||
|
||||
xml = fe.FeXML('Invoice',
|
||||
'http://www.dian.gov.co/contratos/facturaelectronica/v1')
|
||||
xml.add_extension(software_provider_extension)
|
||||
|
||||
give_nit = xml.get_element_text('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/sts:DianExtensions/sts:SoftwareProvider/sts:ProviderID')
|
||||
assert nit == give_nit
|
||||
|
Loading…
Reference in New Issue
Block a user