working on shop and coinify payment

This commit is contained in:
Thomas Steen Rasmussen 2016-05-29 12:29:38 +02:00
parent b938f1374b
commit c36e9c6eb0
3 changed files with 19 additions and 9 deletions

View file

@ -92,6 +92,12 @@ class Order(CreatedUpdatedModel):
) )
)['sum'] )['sum']
def get_coinify_callback_url(self, request):
return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_callback', kwargs={'pk': self.pk}))
def get_coinify_thanks_url(self, request):
return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_thanks', kwargs={'pk': self.pk}))
def get_epay_accept_url(self, request): def get_epay_accept_url(self, request):
return 'https://' + request.get_host() + str(reverse_lazy('shop:epay_thanks', kwargs={'pk': self.pk})) return 'https://' + request.get_host() + str(reverse_lazy('shop:epay_thanks', kwargs={'pk': self.pk}))

View file

@ -70,13 +70,23 @@
{% bootstrap_button "Update order" button_type="submit" button_class="btn-primary" name="update_order" %} {% bootstrap_button "Update order" button_type="submit" button_class="btn-primary" name="update_order" %}
<hr /> <hr />
<h3>Checkout</h3> <h3>Payment options</h3>
{% if not order.paid %}
<p class="lead">Your order is currently unpaid. Please pick a payment option below.</p>
<p><i>If you have already paid but your order is still showing unpaid,
you can <a href="mailto:info@bornhack.dk">email us</a> or use the
<a href="{% url 'contact' %}">contact</a> page for other options.
Please allow for up to a week for bank transfers to be registered,
the other payment methods should be more or less instant.</i></p>
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
{% 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-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-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-piggy-bank'></i> Bank transfer" button_type="submit" button_class="btn-primary" name="payment_method" value="bank_transfer" %}
</form> </form>
{% else %}
<p class="lead">Your order is paid in full.</p>
{% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -337,14 +337,8 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
plugin_name='BornHack 2016 webshop', plugin_name='BornHack 2016 webshop',
plugin_version='1.0', plugin_version='1.0',
description='BornHack 2016 order id #%s' % order.id, description='BornHack 2016 order id #%s' % order.id,
callback_url=reverse( callback_url=order.get_coinify_callback_url,
'shop:coinify_callback', return_url=order.get_coinify_thanks_url,
kwargs={'pk': order.id}
),
return_url=reverse(
'shop:coinify_thanks',
kwargs={'pk': order.id}
),
) )
# Parse response # Parse response