Refactor code structure for improved readability and maintainability
This commit is contained in:
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"files.autoSave": "afterDelay",
|
||||||
|
"files.autoSaveDelay": 1000
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ class ShopConfiguration(models.Model):
|
|||||||
contact_email = models.EmailField(max_length=254, blank=True, null=True)
|
contact_email = models.EmailField(max_length=254, blank=True, null=True)
|
||||||
contact_phone = models.CharField(max_length=20, blank=True, null=True)
|
contact_phone = models.CharField(max_length=20, blank=True, null=True)
|
||||||
contact_address = models.TextField(blank=True, null=True)
|
contact_address = models.TextField(blank=True, null=True)
|
||||||
opening_hours = models.JSONField(blank=True, null=True) #FIXME: vytvoř tvar pro otvírací dobu
|
opening_hours = models.JSONField(blank=True, null=True) #FIXME: vytvoř JSON tvar pro otvírací dobu, přes validátory
|
||||||
|
|
||||||
#Social
|
#Social
|
||||||
facebook_url = models.URLField(max_length=200, blank=True, null=True)
|
facebook_url = models.URLField(max_length=200, blank=True, null=True)
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ from django.shortcuts import render
|
|||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
#TODO: dej public tag pro view, aby to mohl react číst pomocí public axiosu
|
#TODO: dej public tag pro view
|
||||||
|
# rozdělit fieldy podle práv aby se třeba neexposelo citlivé údaje
|
||||||
BIN
backend/thirdparty/zasilkovna/api.png
vendored
Normal file
BIN
backend/thirdparty/zasilkovna/api.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
7
backend/thirdparty/zasilkovna/client.py
vendored
7
backend/thirdparty/zasilkovna/client.py
vendored
@@ -10,10 +10,16 @@ logger = logging.getLogger(__name__)
|
|||||||
WSDL_URL = os.getenv("PACKETA_WSDL_URL", "https://www.zasilkovna.cz/api/soap.wsdl")
|
WSDL_URL = os.getenv("PACKETA_WSDL_URL", "https://www.zasilkovna.cz/api/soap.wsdl")
|
||||||
PACKETA_API_PASSWORD = os.getenv("PACKETA_API_PASSWORD")
|
PACKETA_API_PASSWORD = os.getenv("PACKETA_API_PASSWORD")
|
||||||
|
|
||||||
|
|
||||||
zeepZasClient = Client(wsdl=WSDL_URL)
|
zeepZasClient = Client(wsdl=WSDL_URL)
|
||||||
|
|
||||||
|
|
||||||
class PacketaAPI:
|
class PacketaAPI:
|
||||||
|
#TODO: zeptat se jestli nepřidat další checkovací parametry ohledně zásilkovny např: blokování podle nastavení webu
|
||||||
|
# popřemýšlet, jestli api klíče nenastavit přes configurator webu
|
||||||
|
def __getattribute__(self):
|
||||||
|
if PACKETA_API_PASSWORD is None:
|
||||||
|
raise Exception("Packeta API password is not set in environment variables.")
|
||||||
|
|
||||||
# ---------- CREATE PACKET METHODS ----------
|
# ---------- CREATE PACKET METHODS ----------
|
||||||
|
|
||||||
@@ -150,6 +156,7 @@ class PacketaAPI:
|
|||||||
def create_shipment(self, packet_ids: list):
|
def create_shipment(self, packet_ids: list):
|
||||||
"""
|
"""
|
||||||
Vytvoření zásilky (shipment) z více balíků.
|
Vytvoření zásilky (shipment) z více balíků.
|
||||||
|
|
||||||
packet_ids = ["1234567890", "1234567891", "1234567892"]
|
packet_ids = ["1234567890", "1234567891", "1234567892"]
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user