Refactor order creation and add configuration endpoints

Refactored order creation logic to use new serializers and transaction handling, improving validation and modularity. Introduced admin and public endpoints for shop configuration with sensitive fields protected. Enhanced Zásilkovna (Packeta) integration, including packet widget template, new API fields, and improved error handling. Added django-silk for profiling, updated requirements and settings, and improved frontend Orval config for API client generation.
This commit is contained in:
David Bruno Vontor
2025-12-08 18:19:20 +01:00
parent 5b066e2770
commit 946f86db7e
18 changed files with 606 additions and 309 deletions

View File

@@ -0,0 +1,47 @@
{% load static %}
<script src="https://widget.packeta.com/v6/www/js/library.js"></script>
<input type="hidden" id="packetaApiKey" value="{{ packeta_Api_Key }}">
<script>
const packetaApiKey = document.querySelector('#packetaApiKey').value;
const packetaOptions = {
country: "cz,sk",
language: "cs",
valueFormat: "\"Packeta\",id,carrierId,carrierPickupPointId,name,city,street",
view: "modal",
vendors: [
{
country: "cz",
group: "zbox",
price: 45,
selected: true
},
{
country: "cz",
price: 45,
selected: true
}
],
defaultCurrency: "CZK",
defaultPrice: "45"
};
function showSelectedPickupPoint(point) {
const saveElement = document.querySelector(".packeta-selector-value");
// Add here an action on pickup point selection
saveElement.innerText = '';
if (point) {
console.log("Selected point", point);
saveElement.innerText = "point: " + JSON.stringify(point, null, 4); // DŮLEŽITÉ PRO DALŠÍ ZPRACOVÁNÍ (jenom potřebuji ID)
}
}
</script>
<button class="packeta-selector-open"
onclick="Packeta.Widget.pick(packetaApiKey, showSelectedPickupPoint, packetaOptions)">Select pick-up point</button>
<div class="packeta-selector-value"></div>