|
@@ -4,6 +4,8 @@ import platform
|
|
|
import unittest
|
|
|
import os
|
|
|
|
|
|
+from lxml import etree
|
|
|
+
|
|
|
from anafapi.anafoauth import Anafoauth, Efactoauth
|
|
|
from anafapi import utils
|
|
|
|
|
@@ -53,7 +55,7 @@ class efactTest(unittest.TestCase):
|
|
|
self.efactoauth.transform_to_pdf('c:/Users/DECEL/FACT1/MZK/2023_01_03/MZK2414.xml')
|
|
|
|
|
|
def test_get_all_messages(self):
|
|
|
- self.efactoauth.get_all_messages('17259191', env='prod', extract=True)
|
|
|
+ self.efactoauth.get_all_messages('17259191', days=10, env='prod', extract=True)
|
|
|
|
|
|
def test_pretty_messages(self):
|
|
|
self.efactoauth.pretty_messages('17259191', env='prod')
|
|
@@ -99,10 +101,20 @@ class efactTest(unittest.TestCase):
|
|
|
# self.efactoauth.validate_invoice(os.path.join(root, file))
|
|
|
self.efactoauth.validate_invoice('c:/Users/DECEL/FACT1/MZK/2023_01_03/MZK2414.xml')
|
|
|
|
|
|
+ def test_renamer(self):
|
|
|
+ tree = etree.parse('c:/Users/levi/FACT1/MZK/2023_01_03/MZK2414.xml')
|
|
|
+ root = tree.getroot()
|
|
|
+ parties = root.xpath('//cbc:RegistrationName', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
|
|
|
+ is_date = root.xpath('//cbc:IssueDate', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
|
|
|
+ partie_id = root.xpath('//cbc:CompanyID', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
|
|
|
+ print(parties[1].text, is_date[0].text, partie_id[3].text)
|
|
|
+ # for partie in parties:
|
|
|
+ # print(partie.getparent())
|
|
|
+
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
# unittest.main()
|
|
|
# efactTest().test_add_invoice()
|
|
|
efactTest().test_get_all_messages()
|
|
|
- # anoauth = Anafoauth()
|
|
|
+ # efactTest().test_renamer()
|
|
|
# anoauth.get_token()
|