mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-08 17:58:21 +00:00
feat(payment): add expiration time for payments to enhance payment validity tracking ✨
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m7s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m7s
This commit is contained in:
@ -66,7 +66,8 @@ class ListCreatePaymentView(StaffEditorPermissionMixin, generics.ListCreateAPIVi
|
|||||||
number_of_months = data.get("number_of_months")
|
number_of_months = data.get("number_of_months")
|
||||||
device_ids = data.get("device_ids", [])
|
device_ids = data.get("device_ids", [])
|
||||||
print(amount, number_of_months, device_ids)
|
print(amount, number_of_months, device_ids)
|
||||||
|
current_time = timezone.now()
|
||||||
|
expires_at = current_time + timedelta(minutes=10)
|
||||||
for device_id in device_ids:
|
for device_id in device_ids:
|
||||||
device = Device.objects.filter(id=device_id, user=user).first()
|
device = Device.objects.filter(id=device_id, user=user).first()
|
||||||
print("DEVICE", device)
|
print("DEVICE", device)
|
||||||
@ -91,6 +92,7 @@ class ListCreatePaymentView(StaffEditorPermissionMixin, generics.ListCreateAPIVi
|
|||||||
number_of_months=number_of_months,
|
number_of_months=number_of_months,
|
||||||
paid=data.get("paid", False),
|
paid=data.get("paid", False),
|
||||||
user=user,
|
user=user,
|
||||||
|
expires_at=expires_at,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Connect devices to payment
|
# Connect devices to payment
|
||||||
|
Reference in New Issue
Block a user