Test pay with sith

This commit is contained in:
2025-04-23 00:11:50 +02:00
parent 8af6af1303
commit 2a7c1a6438
7 changed files with 163 additions and 43 deletions

View File

@ -28,12 +28,20 @@ from django.utils.translation import gettext_lazy as _
from core.models import User
from counter.fields import CurrencyField
from counter.models import BillingInfo, Counter, Customer, Product, Refilling, Selling
from counter.models import (
BillingInfo,
Counter,
Customer,
Product,
Refilling,
Selling,
get_eboutic,
)
def get_eboutic_products(user: User) -> list[Product]:
products = (
Counter.objects.get(type="EBOUTIC")
get_eboutic()
.products.filter(product_type__isnull=False)
.filter(archived=False)
.filter(limit_age__lte=user.age)
@ -102,13 +110,6 @@ class Basket(models.Model):
)["total"]
)
@classmethod
def from_session(cls, session) -> Basket | None:
"""The basket stored in the session object, if it exists."""
if "basket_id" in session:
return cls.objects.filter(id=session["basket_id"]).first()
return None
def generate_sales(self, counter, seller: User, payment_method: str):
"""Generate a list of sold items corresponding to the items
of this basket WITHOUT saving them NOR deleting the basket.