add cash payment

This commit is contained in:
Thomas Steen Rasmussen 2016-11-09 12:27:42 +01:00
parent b2cf4cf9ae
commit 4dd2325926
7 changed files with 50 additions and 1 deletions

View file

@ -25,7 +25,7 @@ General Terms and Conditions | {{ block.super }}
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>The amount has been drawn on your account when our invoice has been sent to you.</p>

View file

@ -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),
),
]

View file

@ -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(

12
shop/templates/cash.html Normal file
View file

@ -0,0 +1,12 @@
{% extends 'shop_base.html' %}
{% load bootstrap3 %}
{% load shop_tags %}
{% block shop_content %}
<h2>Pay by Cash</h2>
<p>To pay order #{{ order.id }} you need to <strong>locate an organiser</strong> (in person) and make the cash payment of <b>{{ order.total|currency }}</b>. You need to bring the <strong>order id #{{ order.id }}</strong> as well so we can mark your order as paid.</p>
<p>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 <a href="{% url 'shop:order_detail' pk=order.id %}">go back</a> and pick a different payment method.</p>
<p>When your order has been marked as paid you will receive an invoice by email.</p>
{% endblock %}

View file

@ -91,6 +91,7 @@ quantities - so make sure your order is correct before proceeding!</p>
{% bootstrap_button "<i class='glyphicon glyphicon-credit-card'></i> Credit card" button_type="submit" button_class="btn-primary" name="payment_method" value="credit_card" %}
{% bootstrap_button "<i class='glyphicon glyphicon-bitcoin'></i> Blockchain" button_type="submit" button_class="btn-primary" name="payment_method" value="blockchain" %}
{% bootstrap_button "<i class='glyphicon glyphicon-piggy-bank'></i> Bank transfer" button_type="submit" button_class="btn-primary" name="payment_method" value="bank_transfer" %}
{% bootstrap_button "<i class='glyphicon glyphicon-cash'></i> Cash" button_type="submit" button_class="btn-primary" name="payment_method" value="cash" %}
</form>
<br>
<p><i>If you have already paid but your order is still showing unpaid,

View file

@ -21,6 +21,8 @@ urlpatterns = [
url(r'orders/(?P<pk>[0-9]+)/pay/banktransfer/$', BankTransferView.as_view(), name='bank_transfer'),
url(r'orders/(?P<pk>[0-9]+)/pay/cash/$', CashView.as_view(), name='cash'),
url(r'tickets/$', TicketListView.as_view(), name='ticket_list'),
url(r'tickets/(?P<pk>\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'),

View file

@ -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