diff --git a/frontend/templates/pledge_cancel.html b/frontend/templates/pledge_cancel.html new file mode 100644 index 00000000..33f47f84 --- /dev/null +++ b/frontend/templates/pledge_cancel.html @@ -0,0 +1,16 @@ +{% extends "basedocumentation.html" %} + +{% block title %}Pledge Cancelled{% endblock %} + +{% block extra_extra_head %} + +{% endblock %} + +{% block doccontent %} + +
Would you consider pledging in the future?
+ +
{{output}}
+{% endblock %} + + diff --git a/frontend/templates/pledge_complete.html b/frontend/templates/pledge_complete.html new file mode 100644 index 00000000..f79ad84e --- /dev/null +++ b/frontend/templates/pledge_complete.html @@ -0,0 +1,17 @@ +{% extends "basedocumentation.html" %} + +{% block title %}Pledge Completed{% endblock %} + +{% block extra_extra_head %} + +{% endblock %} + +{% block doccontent %} + +
Thank you!
+ +
{{output}}
+ +{% endblock %} + + diff --git a/frontend/urls.py b/frontend/urls.py index 8b078830..2e5930f6 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -5,7 +5,7 @@ from django.views.generic import ListView, DetailView from django.contrib.auth.decorators import login_required from regluit.core.models import Campaign -from regluit.frontend.views import CampaignFormView, GoodreadsDisplayView, LibraryThingView, PledgeView, FAQView +from regluit.frontend.views import CampaignFormView, GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, FAQView from regluit.frontend.views import CampaignListView, DonateView, WorkListView urlpatterns = patterns( @@ -48,6 +48,8 @@ urlpatterns = patterns( #may want to deprecate the following url(r"^setup/work/(?P\d+)/$", "work", {'action':'setup_campaign'}, name="setup_campaign"), url(r"^pledge/(?P\d+)/$", login_required(PledgeView.as_view()), name="pledge"), + url(r"^pledge/cancel/$", PledgeCancelView.as_view(), name="pledge_cancel"), + url(r"^pledge/complete/$", PledgeCompleteView.as_view(), name="pledge_complete"), url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"), url(r"^subjects/$", "subjects", name="subjects"), url(r"^librarything/$", LibraryThingView.as_view(), name="librarything"), diff --git a/frontend/views.py b/frontend/views.py index 6d453119..4d9274f3 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -300,6 +300,37 @@ class PledgeView(FormView): response = t.reference logger.info("PledgeView paypal: Error " + str(t.reference)) return HttpResponse(response) + +class PledgeCompleteView(TemplateView): + """A callback for PayPal to tell unglue.it that a payment transaction has completed successfully""" + + template_name="pledge_complete.html" + + def get_context_data(self, **kwargs): + # pick up all get and post parameters and display + context = super(PledgeCompleteView, self).get_context_data(**kwargs) + + output = "pledge complete" + output += self.request.method + "\n" + str(self.request.REQUEST.items()) + context["output"] = output + + return context + + +class PledgeCancelView(TemplateView): + """A callback for PayPal to tell unglue.it that a payment transaction has been canceled by the user""" + template_name="pledge_cancel.html" + + def get_context_data(self, **kwargs): + # pick up all get and post parameters and display + context = super(PledgeCancelView, self).get_context_data(**kwargs) + + output = "pledge cancel" + output += self.request.method + "\n" + str(self.request.REQUEST.items()) + context["output"] = output + + return context + class DonateView(FormView): template_name="donate.html" @@ -1085,4 +1116,4 @@ def feedback(request): form = FeedbackForm(initial={"sender":sender, "subject": "Feedback on page "+page, "page":page, "num1":num1, "num2":num2, "answer":sum}) return render(request, "feedback.html", {'form':form, 'num1':num1, 'num2':num2}) - \ No newline at end of file +