feat(billing): add calculate_total_new_price utility for dynamic payment calculation ✨
This commit is contained in:
+4
-2
@@ -15,6 +15,7 @@ from api.tasks import add_new_devices_to_omada
|
||||
from apibase.env import BASE_DIR, env
|
||||
from django.db.models import Prefetch
|
||||
import logging
|
||||
from .utils import calculate_total_new_price
|
||||
|
||||
from .models import Device, Payment, Topup, WalletTransaction
|
||||
from .serializers import (
|
||||
@@ -103,8 +104,9 @@ class ListCreatePaymentView(StaffEditorPermissionMixin, generics.ListCreateAPIVi
|
||||
{"message": "device_ids are required."},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
# Create payment
|
||||
amount = 100
|
||||
amount = calculate_total_new_price(
|
||||
number_of_devices=number_of_devices, number_of_months=number_of_months
|
||||
)
|
||||
payment = Payment.objects.create(
|
||||
amount=amount,
|
||||
number_of_months=number_of_months,
|
||||
|
||||
Reference in New Issue
Block a user