Merge pull request #252 from Gluejar/denied_cc

Denied cc [finish #61351358]
pull/1/head
Raymond Yee 2013-11-25 11:55:21 -08:00
commit 19179f695d
7 changed files with 35 additions and 35 deletions

View File

@ -1,9 +1,13 @@
{% load humanize %}Thanks to you and other ungluers, {{ transaction.campaign.work.title }} will be released to the world in an unglued ebook edition. {% load humanize %}{{ transaction.campaign.work.title }} will be released to the world in an unglued ebook edition.
However, our attempt to charge your credit card in the amount of ${{ transaction.amount|intcomma }} failed ({{transaction.error}}). Don't worry -- typically this means the card on file for you is expired, and once you update your card information we'll be able to collect your pledge on behalf of {{ transaction.campaign.rightsholder }}. Please update your credit card information at However, our attempt to charge your credit card in the amount of ${{ transaction.amount|intcomma }} failed ({{transaction.error}}).
{% ifequal transaction.campaign.type 1 %}Don't worry -- typically this means the card on file for you is expired, and once you update your card information we'll be able to collect your pledge on behalf of {{ transaction.campaign.rightsholder }}. Please update your credit card information at
https://{{ current_site.domain }}{% url manage_account %} by {{ recharge_deadline }} so that you can fulfill your pledge. Thank you! https://{{ current_site.domain }}{% url manage_account %} by {{ recharge_deadline }} so that you can fulfill your pledge. Thank you!
Pledge summary Pledge summary {% else %}Don't worry -- typically this means the card on file for you is expired, and once you update your card information you'll be able to complete your purchase. Please update your credit card information at
https://{{ current_site.domain }}{% url manage_account %}. Thank you!
Transaction summary {% endifequal %}
{% include "notification/pledge_summary.txt" %} {% include "notification/pledge_summary.txt" %}
If you'd like to visit the campaign page, click here: If you'd like to visit the campaign page, click here:

View File

@ -6,7 +6,7 @@
{% endblock %} {% endblock %}
{% block comments_graphical %} {% block comments_graphical %}
The campaign for <a href="{% url work transaction.campaign.work.id %}">{{ transaction.campaign.work.title }}</a> has succeeded. However, our attempt to charge your pledge for ${{ transaction.amount|intcomma }} to your credit card failed ({{transaction.error}}). Will you help us fix that? {% ifequal transaction.campaign.type 1 %}The campaign for <a href="{% url work transaction.campaign.work.id %}">{{ transaction.campaign.work.title }}</a> has succeeded. However, our attempt to charge your pledge for ${{ transaction.amount|intcomma }} to your credit card failed ({{transaction.error}}). Will you help us fix that?{% else %}Our attempt to charge a purchase of ${{ transaction.amount|intcomma }} to your credit card failed ({{transaction.error}}).{% endifequal %}
{% endblock %} {% endblock %}
{% block comments_textual %} {% block comments_textual %}
@ -14,9 +14,9 @@
<p>Thanks to you and other ungluers, {{ transaction.campaign.work.title }} will be released to the world in an unglued ebook edition. <p>Thanks to you and other ungluers, {{ transaction.campaign.work.title }} will be released to the world in an unglued ebook edition.
However, our attempt to charge your credit card for ${{ transaction.amount|intcomma }} failed.</p> However, our attempt to charge your credit card for ${{ transaction.amount|intcomma }} failed.</p>
{% ifequal transaction.campaign.type 1 %}
<p>Don't worry - normally this just means the card we have on file for you is expired. Once you've updated your card information we'll be able to collect your pledge on behalf of {{ transaction.campaign.rightsholder }}. Please update your credit card information at <p>Don't worry - normally this just means the card we have on file for you is expired. Once you've updated your card information we'll be able to collect your pledge on behalf of {{ transaction.campaign.rightsholder }}. Please update your credit card information at
https://{{ current_site.domain }}{% url manage_account %} by {{ recharge_deadline }} so that you can fulfill your pledge. Thank you!</p> <a href="{% url manage_account %}">your account management page</a> by {{ recharge_deadline }} so that you can fulfill your pledge. Thank you!</p>
<p><b>Pledge Summary</b><br /> <p><b>Pledge Summary</b><br />
Amount pledged: {{ transaction.amount|intcomma }}<br /> Amount pledged: {{ transaction.amount|intcomma }}<br />
@ -24,6 +24,14 @@
</p> </p>
<p>We will notify you when the unglued ebook is available for you to read. If you've requested special premiums, the campaign manager, {{ transaction.campaign.rightsholder }}, will be in touch with you via email to request any information needed to deliver your premium. <p>We will notify you when the unglued ebook is available for you to read. If you've requested special premiums, the campaign manager, {{ transaction.campaign.rightsholder }}, will be in touch with you via email to request any information needed to deliver your premium.
</p> </p>
{% else %}
<p>Don't worry - normally this just means the card we have on file for you is expired. Once you've updated your card information You'll be able to complete your purchase. Please update your credit card information at
<a href="{% url manage_account %}">your account management page</a>. Thank you!</p>
<p><b>Transaction Summary</b><br />
Amount of purchase: {{ transaction.amount|intcomma }}<br />
</p>
{% endifequal %}
<p>For more information, visit the <a href="{% url work transaction.campaign.work.id %}">campaign page</a>. <p>For more information, visit the <a href="{% url work transaction.campaign.work.id %}">campaign page</a>.
</p> </p>

View File

@ -1 +1 @@
Attention needed: your pledge to unglue {{transaction.campaign.work.title}} Attention needed: your {% ifequal transaction.campaign.type 1 %}pledge to unglue{% else %}purchase of{% endifequal %} {{transaction.campaign.work.title}}

View File

@ -1,4 +1,5 @@
{% load humanize %} {% load humanize %}
{% ifequal transaction.campaign.type 1 %}
Amount pledged: ${{ transaction.amount|intcomma }} Amount pledged: ${{ transaction.amount|intcomma }}
Premium: {{ transaction.premium.description }} Premium: {{ transaction.premium.description }}
@ -10,4 +11,7 @@ You will also be acknowledged as follows:
- The following dedication will be included in the ebook: - The following dedication will be included in the ebook:
{{ transaction.extra.ack_dedication }}{% else %} {{ transaction.extra.ack_dedication }}{% else %}
- You were eligible to include a dedication in the unglued ebook, but did not choose to do so. If you like, you can change this at https://{{ current_site.domain }}{% url pledge_modify work_id=transaction.campaign.work.id %}. - You were eligible to include a dedication in the unglued ebook, but did not choose to do so. If you like, you can change this at https://{{ current_site.domain }}{% url pledge_modify work_id=transaction.campaign.work.id %}.
{% endif %}{% endifequal %} {% endif %}{% endifequal %}{% else %}
Amount charged: ${{ transaction.amount|intcomma }}
{% endifequal %}

View File

@ -1,7 +1,7 @@
{% extends "basepledge.html" %} {% extends "basepledge.html" %}
{% load humanize %} {% load humanize %}
{% block title %}Credit card processing Error{% endblock %} {% block title %}Credit card processing Issue{% endblock %}
{% block doccontent %} {% block doccontent %}
<div style="height:15px"></div> <div style="height:15px"></div>
@ -9,9 +9,11 @@
<div class="jsmodule rounded clearfix"> <div class="jsmodule rounded clearfix">
<div class="jsmod-content"> <div class="jsmod-content">
<div><h2>Error: Card authorization</h2> <div><h2>Credit Card not Authorized</h2>
<div> <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> </p>
</div> </div>
</div> </div>

View File

@ -637,26 +637,8 @@ class PaymentManager( object ):
# we might want to not allow for a return_url to be passed in but calculated # we might want to not allow for a return_url to be passed in but calculated
# here because we have immediate access to the Transaction object. # here because we have immediate access to the Transaction object.
#if return_url is None:
#
# #return_path = "{0}?{1}".format(reverse('charge_complete'),
# # urllib.urlencode({'tid':transaction.id}))
# return_path = "{0}?{1}".format(reverse('pledge_complete'),
# urllib.urlencode({'tid':transaction.id}))
# return_url = urlparse.urljoin(settings.BASE_URL_SECURE, return_path)
# Question: do I need to set transaction.amount = transaction.max_amount ?
p = transaction.get_payment_class().Pay(transaction, amount=transaction.max_amount, return_url=return_url, paymentReason=paymentReason) p = transaction.get_payment_class().Pay(transaction, amount=transaction.max_amount, return_url=return_url, paymentReason=paymentReason)
# Create a response for this
#envelope = p.envelope()
#
#if envelope:
# r = PaymentResponse.objects.create(api=p.url,
# correlation_id = p.correlation_id(),
# timestamp = p.timestamp(),
# info = p.raw_response,
# transaction=transaction)
if p.success() and not p.error(): if p.success() and not p.error():
transaction.preapproval_key = p.key() transaction.preapproval_key = p.key()

View File

@ -689,8 +689,7 @@ class Processor(baseprocessor.Processor):
transaction.pay_key = p.key() transaction.pay_key = p.key()
transaction.save() transaction.save()
else: else:
transaction.error = p.error_string() self.errorMessage = p.errorMessage #pass error message up
transaction.save()
logger.info("execute_transaction Error: " + p.error_string()) logger.info("execute_transaction Error: " + p.error_string())
def amount( self ): def amount( self ):
@ -709,6 +708,7 @@ class Processor(baseprocessor.Processor):
''' '''
def __init__(self, transaction=None): def __init__(self, transaction=None):
self.transaction = transaction self.transaction = transaction
# make sure transaction hasn't already been executed # make sure transaction hasn't already been executed
@ -716,7 +716,7 @@ class Processor(baseprocessor.Processor):
return return
# make sure we are dealing with a stripe transaction # make sure we are dealing with a stripe transaction
if transaction.host <> PAYMENT_HOST_STRIPE: if transaction.host <> PAYMENT_HOST_STRIPE:
raise StripeLibError("transaction.host {0} is not the expected {1}".format(transaction.host, PAYMENT_HOST_STRIPE)) raise StripelibError("transaction.host {0} is not the expected {1}".format(transaction.host, PAYMENT_HOST_STRIPE))
sc = StripeClient() sc = StripeClient()
@ -744,7 +744,7 @@ class Processor(baseprocessor.Processor):
status=TRANSACTION_STATUS_ERROR, transaction=transaction) status=TRANSACTION_STATUS_ERROR, transaction=transaction)
transaction.status = TRANSACTION_STATUS_ERROR transaction.status = TRANSACTION_STATUS_ERROR
transaction.error = e.message self.errorMessage = e.message # manager puts this on transaction
transaction.save() transaction.save()
# fire off the fact that transaction failed -- should actually do so only if not a transient error # 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: else:
logger.exception("transaction id {0}, exception: {1}".format(transaction.id, e.message)) logger.exception("transaction id {0}, exception: {1}".format(transaction.id, e.message))
raise StripelibError(e.message, e) # raise StripelibError(e.message, e)
else: else:
self.charge = charge self.charge = charge
@ -771,7 +771,7 @@ class Processor(baseprocessor.Processor):
else: else:
# nothing to charge # nothing to charge
raise StripeLibError("No customer id available to charge for transaction {0}".format(transaction.id), None) raise StripelibError("No customer id available to charge for transaction {0}".format(transaction.id), None)
def api(self): def api(self):