feat(topup): add payment_type field and update AdminTopupCreateView to handle payment type ✨
This commit is contained in:
+8
-6
@@ -624,14 +624,16 @@ class AdminTopupCreateView(StaffEditorPermissionMixin, generics.CreateAPIView):
|
||||
{"message": "User not found."},
|
||||
status=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
topup = Topup.objects.create(amount=amount, user=user)
|
||||
description = f"Topup of {amount} MVR (Cash)"
|
||||
WalletTransaction.objects.create(
|
||||
user=user,
|
||||
topup = Topup.objects.create(
|
||||
amount=amount,
|
||||
transaction_type="TOPUP",
|
||||
description=description,
|
||||
user=user,
|
||||
paid=True,
|
||||
paid_at=timezone.now(),
|
||||
payment_type="CASH",
|
||||
status="PAID",
|
||||
)
|
||||
description = f"Topup of {amount} MVR (Cash)"
|
||||
user.add_wallet_funds(amount, description, topup.id)
|
||||
serializer = TopupSerializer(topup)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user