chore: docs and added new field for tpv domain

This commit is contained in:
2025-01-13 18:08:57 +01:00
parent 475b53a7e3
commit 2ff2d08565
12 changed files with 101 additions and 43 deletions
+3 -4
View File
@@ -1,5 +1,4 @@
<svg class="h-4 w-4 text-yellow-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="currentColor" viewBox="0 0 24 24">
<path
d="M13.8 4.2a2 2 0 0 0-3.6 0L8.4 8.4l-4.6.3a2 2 0 0 0-1.1 3.5l3.5 3-1 4.4c-.5 1.7 1.4 3 2.9 2.1l3.9-2.3 3.9 2.3c1.5 1 3.4-.4 3-2.1l-1-4.4 3.4-3a2 2 0 0 0-1.1-3.5l-4.6-.3-1.8-4.2Z"/>
<svg class="h-4 w-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="#CFCA00" viewBox="0 0 24 24">
<path d="M13.8 4.2a2 2 0 0 0-3.6 0L8.4 8.4l-4.6.3a2 2 0 0 0-1.1 3.5l3.5 3-1 4.4c-.5 1.7 1.4 3 2.9 2.1l3.9-2.3 3.9 2.3c1.5 1 3.4-.4 3-2.1l-1-4.4 3.4-3a2 2 0 0 0-1.1-3.5l-4.6-.3-1.8-4.2Z" />
</svg>

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 315 B

@@ -0,0 +1,5 @@
<svg class="h-4 w-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
fill="#101010" viewBox="0 0 24 24">
<path
d="M13.8 4.2a2 2 0 0 0-3.6 0L8.4 8.4l-4.6.3a2 2 0 0 0-1.1 3.5l3.5 3-1 4.4c-.5 1.7 1.4 3 2.9 2.1l3.9-2.3 3.9 2.3c1.5 1 3.4-.4 3-2.1l-1-4.4 3.4-3a2 2 0 0 0-1.1-3.5l-4.6-.3-1.8-4.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 326 B

+2
View File
@@ -80,7 +80,9 @@ class MyAccountView(TemplateView):
def get_context_data(self, **kwargs):
addresses = CustomerAddress.objects.filter(user=self.request.user)
settings = WebSettings.load()
return {
"web_title": settings.web_title,
"customer_addresses": addresses,
}
+21 -13
View File
@@ -1,3 +1,5 @@
from decimal import Decimal
from django.db.models import Sum
from django.http.response import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect, reverse
@@ -79,7 +81,7 @@ class CartDetail(TemplateView, CreateView):
return {
"cart": cart,
"items": cart_items,
"title": web_settings.web_title,
"web_title": web_settings.web_title,
"description": _("resumen del carrito"),
}
@@ -148,15 +150,21 @@ class OrderDetail(TemplateView):
items = OrderLine.objects.select_related("product").filter(
order=order, product__is_shipping_method=False
)
shipping_cost = (
OrderLine.objects.select_related("product")
.filter(
order=order,
product__is_shipping_method=True,
)
.aggregate(amount=Sum("total"))
.get("amount")
)
shipping_cost = OrderLine.objects.select_related("product").filter(
order=order,
product__is_shipping_method=True,
).aggregate(amount=Sum("total")).get("amount") or Decimal("0")
base_total = OrderLine.objects.select_related("product").filter(
order=order,
product__is_shipping_method=False,
).aggregate(amount=Sum("base_total")).get("amount") or Decimal("0")
tax_total = OrderLine.objects.select_related("product").filter(
order=order,
product__is_shipping_method=False,
).aggregate(amount=Sum("taxes")).get("amount") or Decimal("0")
return {
"order": order,
@@ -165,9 +173,9 @@ class OrderDetail(TemplateView):
"merchant_parameters": parameters.get("Ds_MerchantParameters"),
"signature": parameters.get("Ds_Signature"),
"redsys_target_url": redsys_client.get_target_url(),
"total": order.total,
"base_total": order.base_total,
"tax_total": order.total - order.base_total,
"total": round(order.total, 2),
"base_total": round(base_total, 2),
"tax_total": round(tax_total, 2),
"shipping_cost": round(shipping_cost, 2),
}