Fix error handling in Pay

pull/1/head
eric 2013-11-25 13:01:16 -05:00
parent 18f104c210
commit dd83434282
2 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{% extends "basepledge.html" %}
{% load humanize %}
{% block title %}Credit card processing Error{% endblock %}
{% block title %}Credit card processing Issue{% endblock %}
{% block doccontent %}
<div style="height:15px"></div>
@ -9,9 +9,11 @@
<div class="jsmodule rounded clearfix">
<div class="jsmod-content">
<div><h2>Error: Card authorization</h2>
<div><h2>Credit Card not Authorized</h2>
<div>
<p>Unglue.it would like to accept your credit card, but we encountered the following problem: <b>{{exception.message}}</b>. Please <a href="{{ request.get_full_path }}">try again</a>, or contact <a href="mailto:support@gluejar.com?subject={{ request.get_full_path|urlencode }}">unglue.it support</a>.
<p>Unglue.it would like to accept your credit card, but we encountered a problem: <b>{{transaction.error}}</b> {% if request.user.account_set %}Please <a href="{% url manage_account %}">Update your credit card</a>,
{% else %}Please <a href="{{ request.get_full_path }}">try again</a>,{% endif %}
or contact <a href="mailto:support@gluejar.com?subject={{ request.get_full_path|urlencode }}">unglue.it support</a>.
</p>
</div>
</div>

View File

@ -689,8 +689,7 @@ class Processor(baseprocessor.Processor):
transaction.pay_key = p.key()
transaction.save()
else:
transaction.error = p.error_string()
transaction.save()
self.errorMessage = p.errorMessage #pass error message up
logger.info("execute_transaction Error: " + p.error_string())
def amount( self ):
@ -709,6 +708,7 @@ class Processor(baseprocessor.Processor):
'''
def __init__(self, transaction=None):
self.transaction = transaction
# make sure transaction hasn't already been executed
@ -744,7 +744,7 @@ class Processor(baseprocessor.Processor):
status=TRANSACTION_STATUS_ERROR, transaction=transaction)
transaction.status = TRANSACTION_STATUS_ERROR
transaction.error = e.message
self.errorMessage = e.message # manager puts this on transaction
transaction.save()
# fire off the fact that transaction failed -- should actually do so only if not a transient error
@ -755,7 +755,7 @@ class Processor(baseprocessor.Processor):
else:
logger.exception("transaction id {0}, exception: {1}".format(transaction.id, e.message))
raise StripelibError(e.message, e)
# raise StripelibError(e.message, e)
else:
self.charge = charge