Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
Add logging to 3rdman views
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed Jul 10, 2013
1 parent 504da3b commit 7b67238
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion datacash/the3rdman/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import logging

from django.views import generic
from django import http

from datacash import models

logger = logging.getLogger('datacash.the3rdman')


class CallbackView(generic.View):
"""
Expand All @@ -16,8 +20,12 @@ def post(self, request, *args, **kwargs):
# Create a fraud response object. Other processes should listen
# to the post create signal in order to hook fraud processing into
# this order pipeline.
models.FraudResponse.create_from_xml(request.body)
response = models.FraudResponse.create_from_xml(request.body)
except Exception, e:
logger.error("Error raised handling response:\n%s", request.body)
logger.exception(e)
return http.HttpResponseServerError("error")
else:
logger.info("Successful response received with merchant ref %s",
response.merchant_order_ref)
return http.HttpResponse("ok")

0 comments on commit 7b67238

Please sign in to comment.