|
@@ -50,6 +50,7 @@ class Anafoauth(object):
|
|
|
return expires_at > datetime.datetime.today()
|
|
|
|
|
|
def get_token(self) -> ujson:
|
|
|
+ # https://chat.openai.com/c/61c5c1c5-298a-4073-88c7-d69ce99a140e
|
|
|
# oauth = OAuth2Session(self.client_id, redirect_uri=self.redirect_uri)
|
|
|
authorization_url, _state = self.oauth.authorization_url(self.AUTH_URL)
|
|
|
#
|
|
@@ -127,13 +128,14 @@ class Efactoauth(Anafoauth):
|
|
|
#
|
|
|
with open(fp, "r") as file:
|
|
|
files = file.read()
|
|
|
+ files = files.replace('xmlns:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2../../UBL-2.1(1)/xsd/maindoc/UBL-Invoice-2.1.xsd" ', '')
|
|
|
headers = {'Content-Type': 'text/plain'}
|
|
|
# response = requests.post(url, files=files)
|
|
|
url = self.VALIDATE.format(type_)
|
|
|
- print(url)
|
|
|
+ # print(url)
|
|
|
resp = self.oauth.post(url=url, data=files, headers=headers)
|
|
|
print(resp.status_code, resp.text)
|
|
|
- print(resp.status_code, resp.json())
|
|
|
+ # print(resp.status_code, resp.json())
|
|
|
return resp.json()
|
|
|
|
|
|
def transform_to_pdf(self, fp, type_='FACT1', no_validation=False):
|
|
@@ -143,6 +145,8 @@ class Efactoauth(Anafoauth):
|
|
|
#
|
|
|
with open(fp, "r") as file:
|
|
|
files = file.read()
|
|
|
+ files = files.replace(r'xmlns:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2../../UBL-2.1(1)/xsd/maindoc/UBL-Invoice-2.1.xsd" ', '')
|
|
|
+ # print(files)
|
|
|
headers = {'Content-Type': 'text/plain'}
|
|
|
if no_validation:
|
|
|
url = self.TRANSFORM.format(type_, no_validation)
|