mirror of
https://github.com/Eledio/superfaktura-client.git
synced 2025-11-01 00:18:25 +01:00
Revert "Auxiliary commit to revert individual files from 73da343c610420f68792306d5fcdd46f1c86edb8"
This reverts commit e925cf182acf7c18cfd27351e72baed328d43e2c.
This commit is contained in:
@@ -27,7 +27,6 @@ Usage:
|
|||||||
>>> bank.post(data)
|
>>> bank.post(data)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass, asdict
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -93,8 +92,7 @@ class BankAccount(SuperFakturaAPI):
|
|||||||
def list(self) -> dict:
|
def list(self) -> dict:
|
||||||
"""Retrieves a list of bank accounts."""
|
"""Retrieves a list of bank accounts."""
|
||||||
url = "bank_accounts/index"
|
url = "bank_accounts/index"
|
||||||
bank_accounts = self.get(url)
|
return self.get(url)
|
||||||
return json.loads(bank_accounts)
|
|
||||||
|
|
||||||
def default(self) -> Optional[BankAccountModel]:
|
def default(self) -> Optional[BankAccountModel]:
|
||||||
"""Retrieves the default bank account."""
|
"""Retrieves the default bank account."""
|
||||||
|
|||||||
@@ -104,14 +104,12 @@ class ClientContact(SuperFakturaAPI):
|
|||||||
def list(self) -> dict:
|
def list(self) -> dict:
|
||||||
"""Lists all exists client contacts."""
|
"""Lists all exists client contacts."""
|
||||||
url = "clients/index.json"
|
url = "clients/index.json"
|
||||||
clients = self.get(endpoint=url)
|
return self.get(endpoint=url)
|
||||||
return json.loads(clients)
|
|
||||||
|
|
||||||
def get_client(self, client_id: int) -> ClientContactModel:
|
def get_client(self, client_id: int) -> ClientContactModel:
|
||||||
"""Gets a client contact by ID."""
|
"""Gets a client contact by ID."""
|
||||||
url = f"clients/view/{client_id}"
|
url = f"clients/view/{client_id}"
|
||||||
clients = self.get(endpoint=url)
|
data = self.get(endpoint=url)
|
||||||
data = json.loads(clients)
|
|
||||||
if "Client" not in data:
|
if "Client" not in data:
|
||||||
raise ClientException("Client not found")
|
raise ClientException("Client not found")
|
||||||
data = data["Client"]
|
data = data["Client"]
|
||||||
@@ -124,4 +122,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
pprint(resp)
|
pprint(resp)
|
||||||
|
|
||||||
pprint(client.get_client(40011))
|
pprint(client.get_client(40019))
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ Usage:
|
|||||||
print(countries)
|
print(countries)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from superfaktura.superfaktura_api import SuperFakturaAPI
|
from superfaktura.superfaktura_api import SuperFakturaAPI
|
||||||
|
|
||||||
|
|
||||||
@@ -32,5 +30,4 @@ def country_list():
|
|||||||
"""
|
"""
|
||||||
api = SuperFakturaAPI()
|
api = SuperFakturaAPI()
|
||||||
url = "countries"
|
url = "countries"
|
||||||
countries = api.get(url)
|
return api.get(url)
|
||||||
return json.loads(countries)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user