Commit 0f84749d by Clinton Blackburn

Added Payment Cancellation Page

This commit creates a new page intended only for use when the user cancels payment. The previous implementation relied on the CyberSource callback page, which is not useful for orders placed with the E-Commerce Service.
parent 4df2bd33
......@@ -4,9 +4,10 @@ Defines the URL routes for this app.
from django.conf.urls import patterns, url
from .views import OrdersView
from .views import OrdersView, checkout_cancel
urlpatterns = patterns(
'',
url(r'^orders/$', OrdersView.as_view(), name="orders"),
url(r'^checkout/cancel/$', checkout_cancel, name="checkout_cancel"),
)
""" Commerce views. """
import logging
from django.conf import settings
from django.views.decorators.cache import cache_page
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from rest_framework.permissions import IsAuthenticated
......@@ -13,7 +16,9 @@ from commerce.exceptions import ApiError, InvalidConfigurationError
from commerce.http import DetailResponse, InternalRequestErrorResponse
from course_modes.models import CourseMode
from courseware import courses
from edxmako.shortcuts import render_to_response
from enrollment.api import add_enrollment
from microsite_configuration import microsite
from student.models import CourseEnrollment
from openedx.core.lib.api.authentication import SessionAuthenticationAllowInactiveUser
......@@ -123,3 +128,10 @@ class OrdersView(APIView):
except ApiError as err:
# The API will handle logging of the error.
return InternalRequestErrorResponse(err.message)
@cache_page(1800)
def checkout_cancel(_request):
""" Checkout/payment cancellation view. """
context = {'payment_support_email': microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)}
return render_to_response("commerce/checkout_cancel.html", context)
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="../main.html" />
<%block name="pagetitle">${_("Checkout Cancelled")}</%block>
<section class="container">
<h1>${_("Checkout Cancelled")}</h1>
${ _(u"Your transaction has been cancelled. If you feel an error has occurred, contact {email}.").format(
email="<a href=\"mailto:{email}\">{email}</a>".format(email=payment_support_email)) }
</section>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment