From 4dd232592623271887f9518664d8821e50528faa Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 9 Nov 2016 12:27:42 +0100 Subject: [PATCH] add cash payment --- .../legal/general_terms_and_conditions.html | 2 +- shop/migrations/0031_auto_20161109_1000.py | 20 +++++++++++++++++++ shop/models.py | 3 +++ shop/templates/cash.html | 12 +++++++++++ shop/templates/order_detail.html | 1 + shop/urls.py | 2 ++ shop/views.py | 11 ++++++++++ 7 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 shop/migrations/0031_auto_20161109_1000.py create mode 100644 shop/templates/cash.html diff --git a/bornhack/templates/legal/general_terms_and_conditions.html b/bornhack/templates/legal/general_terms_and_conditions.html index 50d841a1..78b2f214 100644 --- a/bornhack/templates/legal/general_terms_and_conditions.html +++ b/bornhack/templates/legal/general_terms_and_conditions.html @@ -25,7 +25,7 @@ General Terms and Conditions | {{ block.super }}

All prices are stated inclusive of value added tax. The price applicable is the price set out next to the product or services in question on the website on the date of ordering.

-

The following credit cards and debit cards can be used for payment: Visa, Mastercard, Visa/Dankort. The fee for credit and debit card payments (1,45%/2,75%) is paid by the Customer. Payment can also be done by bank transfer to our bank account or using blockchain payments. All online purchase payment shall be made online.

+

The following credit cards and debit cards can be used for payment: Visa, Mastercard, Visa/Dankort. The fee for credit and debit card payments (1,45%/2,75%) is paid by the Customer. Payment can also be done by bank transfer to our bank account or using blockchain payments or by cash. All online purchase payment shall be made online.

The amount has been drawn on your account when our invoice has been sent to you.

diff --git a/shop/migrations/0031_auto_20161109_1000.py b/shop/migrations/0031_auto_20161109_1000.py new file mode 100644 index 00000000..afd129fb --- /dev/null +++ b/shop/migrations/0031_auto_20161109_1000.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-09 10:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0030_auto_20160827_0752'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='payment_method', + field=models.CharField(choices=[(b'credit_card', b'Credit card'), (b'blockchain', b'Blockchain'), (b'bank_transfer', b'Bank transfer'), (b'cash', b'Cash')], default=b'', max_length=50), + ), + ] diff --git a/shop/models.py b/shop/models.py index a4e69f7d..c78712fc 100644 --- a/shop/models.py +++ b/shop/models.py @@ -87,17 +87,20 @@ class Order(CreatedUpdatedModel): CREDIT_CARD = 'credit_card' BLOCKCHAIN = 'blockchain' BANK_TRANSFER = 'bank_transfer' + CASH = 'cash' PAYMENT_METHODS = [ CREDIT_CARD, BLOCKCHAIN, BANK_TRANSFER, + CASH, ] PAYMENT_METHOD_CHOICES = [ (CREDIT_CARD, 'Credit card'), (BLOCKCHAIN, 'Blockchain'), (BANK_TRANSFER, 'Bank transfer'), + (CASH, 'Cash'), ] payment_method = models.CharField( diff --git a/shop/templates/cash.html b/shop/templates/cash.html new file mode 100644 index 00000000..f8b3ca37 --- /dev/null +++ b/shop/templates/cash.html @@ -0,0 +1,12 @@ +{% extends 'shop_base.html' %} +{% load bootstrap3 %} +{% load shop_tags %} + +{% block shop_content %} + +

Pay by Cash

+

To pay order #{{ order.id }} you need to locate an organiser (in person) and make the cash payment of {{ order.total|currency }}. You need to bring the order id #{{ order.id }} as well so we can mark your order as paid.

+ +

If physically finding an organiser is inconvenient for you (during events you can find us at the Infodesk, but between events geography can make things difficult) you should go back and pick a different payment method.

+

When your order has been marked as paid you will receive an invoice by email.

+{% endblock %} diff --git a/shop/templates/order_detail.html b/shop/templates/order_detail.html index 050c6522..ed01525a 100644 --- a/shop/templates/order_detail.html +++ b/shop/templates/order_detail.html @@ -91,6 +91,7 @@ quantities - so make sure your order is correct before proceeding!

{% bootstrap_button " Credit card" button_type="submit" button_class="btn-primary" name="payment_method" value="credit_card" %} {% bootstrap_button " Blockchain" button_type="submit" button_class="btn-primary" name="payment_method" value="blockchain" %} {% bootstrap_button " Bank transfer" button_type="submit" button_class="btn-primary" name="payment_method" value="bank_transfer" %} + {% bootstrap_button " Cash" button_type="submit" button_class="btn-primary" name="payment_method" value="cash" %}

If you have already paid but your order is still showing unpaid, diff --git a/shop/urls.py b/shop/urls.py index 5dc7d29b..ff6e3b88 100644 --- a/shop/urls.py +++ b/shop/urls.py @@ -21,6 +21,8 @@ urlpatterns = [ url(r'orders/(?P[0-9]+)/pay/banktransfer/$', BankTransferView.as_view(), name='bank_transfer'), + url(r'orders/(?P[0-9]+)/pay/cash/$', CashView.as_view(), name='cash'), + url(r'tickets/$', TicketListView.as_view(), name='ticket_list'), url(r'tickets/(?P\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)$', TicketDetailView.as_view(), name='ticket_detail'), diff --git a/shop/views.py b/shop/views.py index f9625a9d..b5ad0e9e 100644 --- a/shop/views.py +++ b/shop/views.py @@ -310,6 +310,10 @@ class OrderDetailView( Order.BANK_TRANSFER: reverse_lazy( 'shop:bank_transfer', kwargs={'pk': order.id} + ), + Order.CASH: reverse_lazy( + 'shop:cash', + kwargs={'pk': order.id} ) } @@ -464,7 +468,14 @@ class BankTransferView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUnpai context['total'] = self.get_object().total return context + ################################################################################# +### Cash payment view + +class CashView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUnpaidOrderMixin, EnsureOrderHasProductsMixin, DetailView): + model = Order + template_name = 'cash.html' + class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUnpaidOrderMixin, EnsureClosedOrderMixin, EnsureOrderHasProductsMixin, SingleObjectMixin, RedirectView): model = Order