|
|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
import logging |
|
|
|
|
from django.conf import settings |
|
|
|
|
from django.contrib import messages |
|
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin |
|
|
|
|
@ -33,7 +34,7 @@ class ScoreView(LoginRequiredMixin, View): |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
# transaction = Transaction.objects.get_or_create(customer=request.user, complete=False) |
|
|
|
|
transaction = Transaction.objects.get_or_create(customer=request.user, type='add') |
|
|
|
|
transaction = Transaction.objects.get_or_create(customer=request.user, type='add', complete=False) |
|
|
|
|
user_score = get_object_or_404(User.objects, pk=kwargs.get('pk')) |
|
|
|
|
current_sum_info = InvoiceHistory.objects.filter(user=user_score).aggregate(Sum('sum')) |
|
|
|
|
user_score_balance = current_sum_info['sum__sum'] or 0 |
|
|
|
|
@ -152,11 +153,14 @@ class TmpPaymentAvisoView(View): |
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
|
form = self.form_class(request.POST) |
|
|
|
|
|
|
|
|
|
logging.debug(form.data) |
|
|
|
|
if form.is_valid(): |
|
|
|
|
transaction = form.cleaned_data.get('transaction_id') |
|
|
|
|
transaction_id = form.data.get('transactionId') |
|
|
|
|
transaction = Transaction.objects.get(pk=int(transaction_id)) |
|
|
|
|
logging.debug(form.cleaned_data) |
|
|
|
|
transaction.complete = True |
|
|
|
|
transaction.sum = form.cleaned_data.get('orderSumAmount') |
|
|
|
|
transaction.stages_id = form.data.get('stagesId') |
|
|
|
|
transaction.save() |
|
|
|
|
|
|
|
|
|
res = """<?xml version="1.0" encoding="utf-8"?> |
|
|
|
|
|