Commit f5d3bd62 authored by frekk's avatar frekk
Browse files

fixed bugs

parent 6ff3010a
......@@ -2,6 +2,7 @@ import uuid
from django.db import models
from django.urls import reverse
from django.utils import timezone
from memberdb.models import Membership, make_token
......@@ -15,9 +16,9 @@ class CardPayment(models.Model):
date_paid = models.DateTimeField('Date paid (payment captured)', null=True, blank=True)
def set_paid(self):
card_payment.is_paid = True
card_payment.date_paid =
self.is_paid = True
self.date_paid =
class MembershipPayment(CardPayment):
......@@ -5,7 +5,6 @@ import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import timezone
import squareconnect
from import ApiException
......@@ -31,11 +31,12 @@ class PaymentFormMixin:
return context
def payment_success(self, payment):
messages.success(request, "Your payment of $%1.2f was successful." % amount_aud)
messages.success(self.request, "Your payment of $%1.2f was successful." % (payment.amount / 100.0))
def payment_error(self, payment):
messages.error(request, "Your payment of $%1.2f was unsuccessful. Please try again later." % amount_aud)
messages.error(self.request, "Your payment of $%1.2f was unsuccessful. Please try again later." % (payment.amount / 100.0))
def post(self, request, *args, **kwargs):
nonce = request.POST.get('nonce', None)
......@@ -47,9 +48,9 @@ class PaymentFormMixin:
return self.get(request)
if try_capture_payment(card_payment, nonce):
# redirect to success URL, or redisplay the form with a success message if none is given
return HttpResponseRedirect(self.get_completed_url())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment