From 30ff53c6299ee39015cd322d04f075bb49982e94 Mon Sep 17 00:00:00 2001
From: Levi
Date: Tue, 4 Oct 2016 23:26:02 -0500
Subject: [PATCH 1/2] Added Login View Test. Added Signup View Test. Added
Reset Password View Test. Added Password Reset Confirm View Test. Added
Membership Payment View Test for Post request. Added Membership Payment View
test for urls, Membership Payment View Test tests for urls. Added odd cases
to tests.
---
.../commands/make_membership_charge.py | 67 -----
digitalglarus/test_views.py | 254 +++++++++++++++++-
2 files changed, 244 insertions(+), 77 deletions(-)
diff --git a/digitalglarus/management/commands/make_membership_charge.py b/digitalglarus/management/commands/make_membership_charge.py
index c727c734..4dedc1ff 100644
--- a/digitalglarus/management/commands/make_membership_charge.py
+++ b/digitalglarus/management/commands/make_membership_charge.py
@@ -97,70 +97,3 @@ class Command(BaseCommand):
print(e)
print("-------------------------")
continue
- # for donator_status in donators:
- # donator = donator_status.user.stripecustomer
- # try:
- # Donation.objects.get(created_at__month=current_month,
- # created_at__year=current_year,
- # donator=donator)
- # except Donation.DoesNotExist:
- # try:
- # # Get donator last donation amount
- # last_donation = Donation.objects.filter(donator=donator).last()
- # donation_amount = last_donation.donation
-
- # # Make stripe charge to a customer
- # stripe_utils = StripeUtils()
- # stripe_utils.CURRENCY = self.CURRENCY
- # charge_response = stripe_utils.make_charge(amount=donation_amount,
- # customer=donator.stripe_id)
- # charge = charge_response.get('response_object')
-
- # # Check if the payment was approved
- # if not charge:
- # # There is an error trying to creating the stripe charge
- # context = {
- # 'paymentError': charge_response.get('error'),
- # }
- # print("--------- STRIPE PAYMENT ERROR ---------")
- # print(context)
- # print("-------------------------")
- # continue
- # # Create a donation
- # charge = charge_response.get('response_object')
- # donation_data = {
- # 'cc_brand': charge.source.brand,
- # 'stripe_charge_id': charge.id,
- # 'last4': charge.source.last4,
- # 'billing_address': last_donation.billing_address.id,
- # 'donator': donator.id,
- # 'donation': donation_amount
- # }
- # donation_form = DonationForm(donation_data)
- # if donation_form.is_valid():
- # donation = donation_form.save()
-
- # context = {
- # 'donation': donation,
- # 'base_url': "{0}://{1}".format('https', 'dynamicweb.ungleich.ch')
-
- # }
- # email_data = {
- # 'subject': 'Your donation have been charged',
- # 'to': donation.donator.user.email,
- # 'context': context,
- # 'template_name': 'donation_charge',
- # 'template_path': 'nosystemd/emails/'
- # }
- # email = BaseEmail(**email_data)
- # email.send()
-
- # print("--------- PAYMENT DONATION SUCCESSFULL ---------")
- # print("Donator: %s" % donation.donator.user.email)
- # print("Amount: %s %s" % (donation.donation, self.CURRENCY))
- # print("-----------------------------------------------")
- # except Exception as e:
- # print("--------- ERROR ---------")
- # print(e)
- # print("-------------------------")
- # continue
diff --git a/digitalglarus/test_views.py b/digitalglarus/test_views.py
index 5658a73c..632147da 100644
--- a/digitalglarus/test_views.py
+++ b/digitalglarus/test_views.py
@@ -1,11 +1,25 @@
import json
+from model_mommy import mommy
+from unittest import mock
from django.test import TestCase
+from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.urlresolvers import resolve
from cms.test_utils.testcases import CMSTestCase
+from django.contrib.auth.tokens import default_token_generator
+from django.utils.http import urlsafe_base64_encode
+from django.utils.encoding import force_bytes
from cms.api import create_page
+from membership.models import CustomUser, StripeCustomer
+from utils.tests import BaseTestCase
+
+
+from .views import LoginView, SignupView, PasswordResetView, PasswordResetConfirmView,\
+ MembershipPricingView, MembershipPaymentView
+from .models import MembershipType
+
class ContactViewTest(TestCase):
def setUp(self):
@@ -38,14 +52,234 @@ class ViewsTest(CMSTestCase):
self.assertEqual(res2.status_code, 200)
-class CalendarApiTestCase(TestCase):
- def test_api_response(self):
- calendar_api_url_1 = reverse('digitalglarus:calendar_api_1', kwargs={'month': '3', 'year': '2016'})
- res1 = self.client.get(calendar_api_url_1)
- pd = json.loads(res1.content.decode('utf-8'))
- self.assertEqual(pd['month'], '3')
- self.assertEqual(pd['year'], '2016')
+class MembershipPricingViewTest(BaseTestCase):
- # TODO:check post
- # calendar_api_url = reverse('digitalglarus:calendar_api')
- # res = self.client.get(calendar_api_url)
+ def setUp(self):
+ super(MembershipPricingViewTest, self).setUp()
+
+ self.membership_type = mommy.make(MembershipType)
+ self.url = reverse('digitalglarus:membership_pricing')
+ self.view = MembershipPricingView
+ self.expected_template = 'digitalglarus/membership_pricing.html'
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+ # Anonymous user should get data
+ response = self.client.get(self.url)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.context['membership_type'], self.membership_type)
+ self.assertTemplateUsed(response, self.expected_template)
+
+
+class MembershipPaymentViewTest(BaseTestCase):
+
+ def setUp(self):
+ super(MembershipPaymentViewTest, self).setUp()
+
+ self.membership_type = mommy.make(MembershipType)
+ self.url = reverse('digitalglarus:membership_payment')
+ self.view = MembershipPaymentView
+ self.expected_template = 'digitalglarus/membership_payment.html'
+
+ # post data
+ self.billing_address = {
+ 'street_address': 'street name',
+ 'city': 'MyCity',
+ 'postal_code': '32123123123123',
+ 'country': 'VE',
+ 'token': 'a23kfmslwxhkwis',
+ 'membership_type': self.membership_type.id
+ }
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+
+ # Anonymous user should get redirect to login
+ response = self.client.get(self.url)
+ expected_url = "%s?next=%s" % (reverse('digitalglarus:signup'),
+ reverse('digitalglarus:membership_payment'))
+ self.assertRedirects(response, expected_url=expected_url,
+ status_code=302, target_status_code=200)
+
+ # Logged user should get the page
+ response = self.customer_client.get(self.url, follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.context['stripe_key'],
+ settings.STRIPE_API_PUBLIC_KEY)
+ self.assertEqual(response.context['membership_type'],
+ self.membership_type)
+
+ @mock.patch('utils.stripe_utils.StripeUtils.create_customer')
+ def test_post(self, stripe_mocked_call):
+
+ # Anonymous user should get redirect to login
+ response = self.client.post(self.url)
+ expected_url = "%s?next=%s" % (reverse('digitalglarus:signup'),
+ reverse('digitalglarus:membership_payment'))
+ self.assertRedirects(response, expected_url=expected_url,
+ status_code=302, target_status_code=200)
+
+ # Customer user should be able to pay
+ stripe_mocked_call.return_value = {
+ 'paid': True,
+ 'response_object': self.stripe_mocked_customer,
+ 'error': None
+ }
+ response = self.customer_client.post(self.url, self.billing_address)
+ import pdb
+ pdb.set_trace()
+ self.assertEqual(response.status_code, 200)
+ self.assertTrue(StripeCustomer.objects.filter(user__email=self.customer.email).exists())
+ stripe_customer = StripeCustomer.objects.get(user__email=self.customer.email)
+ # self.assertEqual(stripe_customer.user, self.customer)
+ # self.assertTrue(HostingOrder.objects.filter(customer=stripe_customer).exists())
+ # hosting_order = HostingOrder.objects.filter(customer=stripe_customer)[0]
+ # vm_plan = {
+ # 'cores': hosting_order.vm_plan.cores,
+ # 'memory': hosting_order.vm_plan.memory,
+ # 'disk_size': hosting_order.vm_plan.disk_size,
+ # 'price': hosting_order.vm_plan.price,
+ # 'hosting_company': hosting_order.vm_plan.vm_type.hosting_company,
+ # 'configuration': hosting_order.vm_plan.configuration
+ # }
+ # self.assertEqual(vm_plan, self.session_data.get('vm_specs'))
+
+
+class LoginViewTest(TestCase):
+
+ def setUp(self):
+ self.url = reverse('digitalglarus:login')
+ self.view = LoginView
+ self.expected_template = 'digitalglarus/login.html'
+ self.user = mommy.make('membership.CustomUser')
+ self.password = 'fake_password'
+ self.user.set_password(self.password)
+ self.user.save()
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+ response = self.client.get(self.url)
+ self.assertEqual(response.status_code, 200)
+ self.assertTemplateUsed(response, self.expected_template)
+
+ def test_anonymous_user_can_login(self):
+ data = {
+ 'email': self.user.email,
+ 'password': self.password
+ }
+ response = self.client.post(self.url, data=data, follow=True)
+ self.assertEqual(response.context['user'], self.user)
+ self.assertEqual(response.status_code, 200)
+
+
+class SignupViewTest(TestCase):
+
+ def setUp(self):
+ self.url = reverse('digitalglarus:signup')
+ self.expected_template = 'digitalglarus/signup.html'
+ self.view = SignupView
+ self.signup_data = {
+ 'name': 'ungleich',
+ 'email': 'test@ungleich.com',
+ 'password': 'fake_password',
+ 'confirm_password': 'fake_password',
+ }
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+ response = self.client.get(self.url)
+ self.assertEqual(response.status_code, 200)
+ self.assertTemplateUsed(response, self.expected_template)
+
+ def test_anonymous_user_can_signup(self):
+ response = self.client.post(self.url, data=self.signup_data, follow=True)
+ self.user = CustomUser.objects.get(email=self.signup_data.get('email'))
+ self.assertEqual(response.context['user'], self.user)
+ self.assertEqual(response.status_code, 200)
+
+
+class PasswordResetViewTest(BaseTestCase):
+
+ def setUp(self):
+ super(PasswordResetViewTest, self).setUp()
+
+ self.url = reverse('digitalglarus:reset_password')
+ self.view = PasswordResetView
+ self.expected_template = 'digitalglarus/reset_password.html'
+ self.user = mommy.make('membership.CustomUser')
+ self.password = 'fake_password'
+ self.user.set_password(self.password)
+ self.user.save()
+
+ self.post_data = {
+ 'email': self.user.email
+ }
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+ response = self.client.get(self.url)
+ self.assertEqual(response.status_code, 200)
+ self.assertTemplateUsed(response, self.expected_template)
+
+ def test_post(self):
+ response = self.client.post(self.url, data=self.post_data, follow=True)
+ self.assertEqual(response.status_code, 200)
+
+ def test_test_generate_email_context(self):
+ context = self.setup_view(self.view()).\
+ test_generate_email_context(self.user)
+ self.assertEqual(context.get('user'), self.user)
+ self.assertEqual(context.get('site_name'), 'ungleich')
+ self.assertEqual(len(context.get('token')), 24)
+
+
+class PasswordResetConfirmViewTest(BaseTestCase):
+
+ def setUp(self):
+ super(PasswordResetConfirmViewTest, self).setUp()
+
+ self.view = PasswordResetConfirmView
+ self.expected_template = 'digitalglarus/confirm_reset_password.html'
+ self.user = mommy.make('membership.CustomUser')
+ self.password = 'fake_password'
+ self.user.set_password(self.password)
+ self.user.save()
+
+ self.token = default_token_generator.make_token(self.user)
+ self.uid = urlsafe_base64_encode(force_bytes(self.user.pk))
+ self.url = reverse('digitalglarus:reset_password_confirm',
+ kwargs={'token': self.token, 'uidb64': self.uid})
+
+ self.post_data = {
+ 'new_password1': 'new_password',
+ 'new_password2': 'new_password'
+ }
+
+ def test_url_resolve_to_view_correctly(self):
+ found = resolve(self.url)
+ self.assertEqual(found.func.__name__, self.view.__name__)
+
+ def test_get(self):
+ response = self.client.get(self.url)
+ self.assertEqual(response.status_code, 200)
+ self.assertTemplateUsed(response, self.expected_template)
+
+ def test_post(self):
+ response = self.client.post(self.url, data=self.post_data, follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertTrue(not response.context['form'].errors)
From 082f39e9dc264aff277ac8c49797c584b5946112 Mon Sep 17 00:00:00 2001
From: Levi
Date: Thu, 13 Oct 2016 23:33:48 -0500
Subject: [PATCH 2/2] Added url in booking&price menu bar button. Fixed bug
when user booked for 1 days and two free days were being given. Created
UserBillingAddress. Created UserBillingAddress Form.Created
UserBillingAddress after first user payment. Added Previous Billing data to
booking payment view if there is one. Moved booking button. Fixed error on
free days in booking invoice. Added modal to cancel subscription page. Now a
member can booking without entering his billing address or credit card info.
Fixed error on free days.Current user billing address is showed on billing
and booking order details. Edit billing address form added.Added
user_billing_address.html. Added user billing address get views. Filled user
billing address view with current user billing address.Now an user can edit
his billing address. Added is_free flag in Select Booking Dates in order to
now if a booking is free. Changed Booking Order Model in order to allow free
payments. Added free payment template. Added free payment into Booking
Payment View. Fixed issue #2586: new digitalglarus navbar font change.Fixed
issue #2608 : style fix new DG.Fixed #2617: fix input fields and btn
responsiveness on DG payment page. Fixed #2620: responsive issue in DG order
summary.Fixed #2623: Order history style fix for deativate button and message
below.Fixed #2625: DG membership activation page fix. Fixed #2616: fix navbar
responsivness for new DG. Fixed #2619: credit card input field responsiveness
fix
---
digitalglarus/forms.py | 2 +-
.../migrations/0020_auto_20161013_0253.py | 35 ++++++
digitalglarus/mixins.py | 6 +-
digitalglarus/models.py | 32 +++--
.../static/digitalglarus/css/agency.css | 4 +-
.../static/digitalglarus/css/price.css | 4 +-
.../static/digitalglarus/js/payment.js | 9 ++
.../digitalglarus/booking_orders_list.html | 12 +-
.../digitalglarus/booking_payment.html | 63 +++++++---
.../digitalglarus/membership_activated.html | 2 +-
.../digitalglarus/membership_deactivated.html | 26 ++++-
.../membership_orders_detail.html | 1 +
.../digitalglarus/membership_orders_list.html | 53 ++++++---
.../digitalglarus/membership_payment.html | 6 +-
.../digitalglarus/user_billing_address.html | 83 +++++++++++++
digitalglarus/templates/new_base_glarus.html | 2 +-
digitalglarus/test_views.py | 27 +++--
digitalglarus/urls.py | 3 +-
digitalglarus/views.py | 110 +++++++++++++++++-
utils/forms.py | 15 ++-
utils/migrations/0003_userbillingaddress.py | 34 ++++++
utils/migrations/0004_auto_20161013_0253.py | 22 ++++
utils/models.py | 29 ++++-
23 files changed, 500 insertions(+), 80 deletions(-)
create mode 100644 digitalglarus/migrations/0020_auto_20161013_0253.py
create mode 100644 digitalglarus/templates/digitalglarus/user_billing_address.html
create mode 100644 utils/migrations/0003_userbillingaddress.py
create mode 100644 utils/migrations/0004_auto_20161013_0253.py
diff --git a/digitalglarus/forms.py b/digitalglarus/forms.py
index 4084ced5..6982037f 100644
--- a/digitalglarus/forms.py
+++ b/digitalglarus/forms.py
@@ -57,7 +57,7 @@ class MembershipOrderForm(forms.ModelForm):
class BookingBillingForm(BillingAddressForm):
- token = forms.CharField(widget=forms.HiddenInput())
+ token = forms.CharField(widget=forms.HiddenInput(), required=False)
start_date = forms.DateField(widget=forms.HiddenInput())
end_date = forms.DateField(widget=forms.HiddenInput())
price = forms.FloatField(widget=forms.HiddenInput())
diff --git a/digitalglarus/migrations/0020_auto_20161013_0253.py b/digitalglarus/migrations/0020_auto_20161013_0253.py
new file mode 100644
index 00000000..f9d49868
--- /dev/null
+++ b/digitalglarus/migrations/0020_auto_20161013_0253.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.4 on 2016-10-13 02:53
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('digitalglarus', '0019_auto_20160929_0324'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='bookingorder',
+ name='cc_brand',
+ field=models.CharField(blank=True, max_length=10),
+ ),
+ migrations.AlterField(
+ model_name='bookingorder',
+ name='last4',
+ field=models.CharField(blank=True, max_length=4),
+ ),
+ migrations.AlterField(
+ model_name='membershiporder',
+ name='cc_brand',
+ field=models.CharField(blank=True, max_length=10),
+ ),
+ migrations.AlterField(
+ model_name='membershiporder',
+ name='last4',
+ field=models.CharField(blank=True, max_length=4),
+ ),
+ ]
diff --git a/digitalglarus/mixins.py b/digitalglarus/mixins.py
index 013cdd78..5392ad37 100644
--- a/digitalglarus/mixins.py
+++ b/digitalglarus/mixins.py
@@ -32,8 +32,8 @@ class Ordereable(models.Model):
billing_address = models.ForeignKey(BillingAddress)
created_at = models.DateTimeField(auto_now_add=True)
approved = models.BooleanField(default=False)
- last4 = models.CharField(max_length=4)
- cc_brand = models.CharField(max_length=10)
+ last4 = models.CharField(max_length=4, blank=True)
+ cc_brand = models.CharField(max_length=10, blank=True)
stripe_charge_id = models.CharField(max_length=100, null=True)
class Meta:
@@ -43,6 +43,8 @@ class Ordereable(models.Model):
def create(cls, data):
stripe_charge = data.pop('stripe_charge', None)
instance = cls.objects.create(**data)
+ if not stripe_charge:
+ return instance
instance.stripe_charge_id = stripe_charge.id
instance.last4 = stripe_charge.source.last4
instance.cc_brand = stripe_charge.source.brand
diff --git a/digitalglarus/models.py b/digitalglarus/models.py
index 17621bfd..9d423f3d 100644
--- a/digitalglarus/models.py
+++ b/digitalglarus/models.py
@@ -71,12 +71,12 @@ class Membership(models.Model):
@classmethod
def is_digitalglarus_active_member(cls, user):
past_month = (datetime.today() - relativedelta(months=1)).month
- has_booking_current_month = Q(membershiporder__customer__user=user,
- membershiporder__created_at__month=datetime.today().month)
- has_booking_past_month = Q(membershiporder__customer__user=user,
- membershiporder__created_at__month=past_month)
+ has_order_current_month = Q(membershiporder__customer__user=user,
+ membershiporder__created_at__month=datetime.today().month)
+ has_order_past_month = Q(membershiporder__customer__user=user,
+ membershiporder__created_at__month=past_month)
active_membership = Q(active=True)
- return cls.objects.filter(has_booking_past_month | has_booking_current_month).\
+ return cls.objects.filter(has_order_past_month | has_order_current_month).\
filter(active_membership).exists()
def deactivate(self):
@@ -147,7 +147,7 @@ class Booking(models.Model):
def get_ramaining_free_days(cls, user, start_date, end_date):
TWO_DAYS = 2
-
+ ONE_DAY = 1
start_month = start_date.month
end_month = end_date.month
months = abs(start_month - (end_month + 12) if end_month < start_month
@@ -156,6 +156,10 @@ class Booking(models.Model):
current_month_bookings = cls.objects.filter(bookingorder__customer__user=user,
start_date__month=current_date.month)
free_days_this_month = TWO_DAYS - sum(map(lambda x: x.free_days, current_month_bookings))
+
+ if start_date == end_date and free_days_this_month == TWO_DAYS:
+ free_days_this_month = ONE_DAY
+
total_free_days = months * TWO_DAYS + free_days_this_month
return total_free_days
@@ -190,11 +194,11 @@ class Booking(models.Model):
# Calculating membership required months price for booking
required_membership_months = 0
membership_booking_price = 0.0
- if BookingOrder.user_has_not_bookings(user):
- today = datetime.today().date()
- membership_price = MembershipType.objects.get(name=MembershipType.STANDARD).price
- required_membership_months = cls.membership_required_booking_months(today, end_date)
- membership_booking_price = membership_price * required_membership_months
+ # if not BookingOrder.user_has_not_bookings(user):
+ today = datetime.today().date()
+ membership_price = MembershipType.objects.get(name=MembershipType.STANDARD).price
+ required_membership_months = cls.membership_required_booking_months(today, end_date)
+ membership_booking_price = membership_price * required_membership_months
# Add required membership months to final prices
final_booking_price += membership_booking_price
@@ -210,11 +214,15 @@ class BookingOrder(Ordereable, models.Model):
membership_required_months = models.IntegerField(default=0)
membership_required_months_price = models.FloatField(default=0)
-
@classmethod
def user_has_not_bookings(cls, user):
return cls.objects.filter(customer__user=user).exists()
+ def get_booking_cc_data(self):
+ return {
+ 'last4': self.last4,
+ 'cc_brand': self.cc_brand,
+ }
def booking_days(self):
return (self.booking.end_date - self.booking.start_date).days + 1
diff --git a/digitalglarus/static/digitalglarus/css/agency.css b/digitalglarus/static/digitalglarus/css/agency.css
index 7be17307..39289c6e 100755
--- a/digitalglarus/static/digitalglarus/css/agency.css
+++ b/digitalglarus/static/digitalglarus/css/agency.css
@@ -241,6 +241,8 @@ fieldset[disabled] .btn-xl.active {
.navbar-default .navbar-collapse {
border-color: rgba(255,255,255,.02);
+ padding-right: 100px;
+ text-align: right;
}
.navbar-default .navbar-toggle {
@@ -259,7 +261,7 @@ fieldset[disabled] .btn-xl.active {
.navbar-default .nav li a {
text-transform: uppercase;
- font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 400;
letter-spacing: 1px;
color: #fff;
diff --git a/digitalglarus/static/digitalglarus/css/price.css b/digitalglarus/static/digitalglarus/css/price.css
index 22d37b99..359b47fe 100644
--- a/digitalglarus/static/digitalglarus/css/price.css
+++ b/digitalglarus/static/digitalglarus/css/price.css
@@ -197,7 +197,7 @@
}
.glyphicon-ok {
- font-size: 42px;
+ font-size: 28px;
display: block;
text-align: center;
margin-bottom: 20px;
@@ -364,7 +364,7 @@
}
.form-control {
- color: #999;
+ color: #000;
border-radius: 0px;
box-shadow: none;
}
diff --git a/digitalglarus/static/digitalglarus/js/payment.js b/digitalglarus/static/digitalglarus/js/payment.js
index dd6c64d4..d9c6e0f7 100644
--- a/digitalglarus/static/digitalglarus/js/payment.js
+++ b/digitalglarus/static/digitalglarus/js/payment.js
@@ -24,12 +24,21 @@ $( document ).ready(function() {
}
});
+ var submit_form_btn = $('#payment_button');
+ submit_form_btn.on('click', submit_payment);
+
+ function submit_payment(e){
+ $('#billing-form').submit();
+ // $form.submit();
+ }
+
var $form = $('#payment-form');
$form.submit(payWithStripe);
/* If you're using Stripe for payments */
function payWithStripe(e) {
+ console.log("submiting");
e.preventDefault();
/* Visual feedback */
diff --git a/digitalglarus/templates/digitalglarus/booking_orders_list.html b/digitalglarus/templates/digitalglarus/booking_orders_list.html
index bff0e231..9fa3d793 100644
--- a/digitalglarus/templates/digitalglarus/booking_orders_list.html
+++ b/digitalglarus/templates/digitalglarus/booking_orders_list.html
@@ -39,11 +39,15 @@
- Billing AdressEdit
- Nico Schottelius
- In der Au 7 8762 Schwanden
- Switzerland
+ Billing AdressEdit
+
+ {{request.user.name}}
+
+ {{billing_address.street_address}},{{billing_address.postal_code}}
+ {{billing_address.city}}, {{billing_address.country}}.
+
+
diff --git a/digitalglarus/templates/digitalglarus/booking_payment.html b/digitalglarus/templates/digitalglarus/booking_payment.html
index fda2a0e2..8613dcab 100644
--- a/digitalglarus/templates/digitalglarus/booking_payment.html
+++ b/digitalglarus/templates/digitalglarus/booking_payment.html
@@ -27,7 +27,7 @@
Booking
- Billing Adress
+
Your Digital Glarus Membership enables
you to use our coworking space and it includes
@@ -37,7 +37,25 @@
15CHF per day. More than 17 days a month it
will charge only 290CHF/month.
+ {% if is_free %}
+ Billing Adress
+
+
+
+
+
+ Your Booking is TOTALLY FREE
+
+ {% else %}
+ Billing Adress
- Credit Card
+ {% if credit_card_data %}
+
+ {% else %}
+ Credit Card (Last used)
diff --git a/digitalglarus/templates/digitalglarus/membership_activated.html b/digitalglarus/templates/digitalglarus/membership_activated.html
index f899f6ec..db641555 100644
--- a/digitalglarus/templates/digitalglarus/membership_activated.html
+++ b/digitalglarus/templates/digitalglarus/membership_activated.html
@@ -24,7 +24,7 @@
Go to Booking
-
Your membership will be automatically renewed each month. For deactivating go tomy page
+
Your membership will be automatically renewed each month. For deactivating go todeactivate page
diff --git a/digitalglarus/templates/digitalglarus/membership_deactivated.html b/digitalglarus/templates/digitalglarus/membership_deactivated.html
index 3bfe3809..7ce1137f 100644
--- a/digitalglarus/templates/digitalglarus/membership_deactivated.html
+++ b/digitalglarus/templates/digitalglarus/membership_deactivated.html
@@ -22,7 +22,28 @@
@@ -32,6 +53,9 @@
+
+
+
diff --git a/digitalglarus/templates/digitalglarus/membership_orders_detail.html b/digitalglarus/templates/digitalglarus/membership_orders_detail.html
index 817c818a..2f1ef140 100644
--- a/digitalglarus/templates/digitalglarus/membership_orders_detail.html
+++ b/digitalglarus/templates/digitalglarus/membership_orders_detail.html
@@ -60,6 +60,7 @@
Membership month {{order.created_at|date:"F"}}
{{order.amount|floatformat}}CHF
+
Total
{{order.amount|floatformat}}CHF
diff --git a/digitalglarus/templates/digitalglarus/membership_orders_list.html b/digitalglarus/templates/digitalglarus/membership_orders_list.html
index 159e1379..8247835a 100644
--- a/digitalglarus/templates/digitalglarus/membership_orders_list.html
+++ b/digitalglarus/templates/digitalglarus/membership_orders_list.html
@@ -38,11 +38,14 @@
{% endfor %}
-
- Billing AdressEdit
- Nico Schottelius
- In der Au 7 8762 Schwanden
- Switzerland
+
+ Billing AdressEdit
+
+ {{request.user.name}}
+
+
+ {{billing_address.street_address}},{{billing_address.postal_code}}
+ {{billing_address.city}}, {{billing_address.country}}.
@@ -50,14 +53,15 @@
Dates: {{membership_start_date|date}} - {{membership_end_date|date}}
-
+
+
-
-
You will be charged on the first of the month until you
- cancel your subscription. Previous charges won't be refunded.
+
+
You will be charged on the first of the month until you
+ cancel your subscription. Previous charges won't be refunded.
@@ -66,19 +70,38 @@
+
-
Thank You!
+
+ {% if messages %}
+
+
Message
+
+ {% for message in messages %}
+ {{ message }}
+ {% endfor %}
+
+ {% else %}
+
+
Thank You!
+
+
+
Digital Glarus lives with your love!
Our coworking space is here because of your love and support.
+
This box is here just to thank you
+
+ {% endif %}
+
+
+
-
This box is here just to thank you
-
-
+
diff --git a/digitalglarus/templates/digitalglarus/membership_payment.html b/digitalglarus/templates/digitalglarus/membership_payment.html
index bde934de..824d46a9 100644
--- a/digitalglarus/templates/digitalglarus/membership_payment.html
+++ b/digitalglarus/templates/digitalglarus/membership_payment.html
@@ -56,14 +56,14 @@