chore: docs and added new field for tpv domain
This commit is contained in:
@@ -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
@@ -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),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user